I found a way to tackle my problem with another script. The way I used was much more efficient.
How do I spawn multiple objects in a limited area, at the start of the game?
I am creating a game in which you play as a plant, growing infinitely, while avoiding objects. I need help creating a code that will randomly place clouds along the map. I want them to spawn between:
x= -10, 10
y= -13, infinity (or a large number because infinity would overload a computer)
I tried this script:
var lastObjPos : Vector3
var obst : Transform;
Instantiate(obst,lastObjPos,Quarternion.identity);
lastObstPos = ((lastObstPos.x + Random.Range()),(lastObstPos.y + Random.Range());
I was able to insert values into the Inspector and I got results. However, I was confused on how to create values for JUST x and JUST y.
I need help creating a script that lets me input the area where clouds spawn, being an input for (min x, max x, min y, max y) It must also spawn the objects at the start of the game.
Please if you can help me, that would be amazing!
Follow this Question
Related Questions
SetActive() not working on pooled objects? 2 Answers
identify arrayed game objects 2 Answers
Button on win? 2 Answers
clone a game object and use it 0 Answers