Need Help with only allowing the player to place and destroy blocks close to him

I’m making a 2d sandbox game. The player can place a destroy blocks, but right now the player can put them anywhere on the screen. I want the player to only be able to place and destroy blocks in a certain radius of the player. How would I go about doing that? Thanks in advance!

Add a CircleCollider2D to the blocks and make it a trigger by enabling the IsTrigger check box.

Add a script and add the following lines:

void OnTriggerStay2D(Collider2D col)
    if (col.gameObject.tag == "Player")
        //your box is in range, do something here.

This way your boxes are constantly detecting the range of the player. If they are withing the radius of the their collider then they are able to be hit by the player.

You can of course change the collider to a BoxCollider2D if that is more appropriate.

Will the collider intefere with other blocks because my world is made up of them kind of like a minecraft.

Just check the distance between the click point and the player is less than a certain value.

No need for extra colliders on every block like the above answer.