Question by
JohnSalagaj · Nov 03, 2015 at 08:52 PM ·
editorrandomtools
Can I instantiate an object at a random location?
Hi all, so I am making a 3D Collections game where the player has to collect coins in each level to complete it. For that game I am trying to create a tool where I can just hit a button in the Editor and the object will appear at a random position on the play space. I already have the Editor Button (I used the Unity tutorial) but need help trying to get the position of the newly spawned object to go to a random position. Is there a way I can do that?
Comment
Answer by Dave-Carlile · Nov 03, 2015 at 08:54 PM
Random.insideUnitSphere is probably a good starting point. It gives you a random point inside of a unit sphere. You can then multiply that by the desired radius to move it out into a larger area.
Your answer
