How can I generate an object on my play ground? Note that there are some locations where the new generated item can't be placed.

(Click on image to see the real size)

I was following a tutorial on the site from unity but now I'll add some features by my own. In the tutorial I've done anything whit the 'Navigation'-tab.

(Click on image to see the real size)

For what I need is the blue area on the screenshot above, are good locations to generate a new object on a random place.

However, there are some locations (see red marks on image) where the objects can't be generated because that are the places where the players enemy's spawns.

Can anyone help me to generate the objects?
Thanks in advance.


1 Answer 1


You can do this by simple trick.

Place empty GameObjects where you want to spawn your object. Then take an public Array of Transform. Then spawn at any random transform.position in scripts. :)

For clear visuals, place cubes on desired places then delete collider and hide meshes, so it will work as transform only


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .