How do i change a sprite when another gameobject with the same prefab is colliding / is near

I want to make it so that when the player places two blocks of for example grass next to eachother they get edges the left edge on the left side and the right edge on the right side. And if they are 3 blocks together or more there will be middle sprite(s) with no edges. I’m working with like 100 sprites and i managed to hardcode 3 of them together in a row as i wanted them to look like. But i can’t hardcode it when the player is supposed to place it .

alt text Sorry for the bad drawing but hopefully you understand what i mean Would appreciate any help .

If you’re working with a grid (which I assume) you can simply call a method on all neighbouring tiles(±x,±y) that updates the sprite based on its neighbor