Iterate through area descibed by objects

Hi,
I write a 2d grid-based game with grid 1x1 - when I move stay after player objects (all objects are 1x1),
how can i iterate closed area described by objects?
Many thanks for help.

It’s look that:
101410-grid.jpg
and I want to Instantiate objects where i marked black pencil… how can i do this?

Just create an array taking an integer variable which signifies a condition for each grid square, for example:

  1. player cannot walk on to
  2. player can walk but not walked yet
  3. player can walk and walked on it

And you can make more conditions than that.
Then based on the condition, change the color of the tile using instantiate and destroy old objects if you have to. If you have an array then you can easily iterate using a for each loop.