- Home /
Various of Random Numbers?
i'm so sorry, for double posting, but my last post is a mess, and i can't get my head around it.
what i'm trying to do, is create random X position, for my spawn point, where it would instatiate a x number of enemies. i'm tryng to use Random.Range, but all it does it create one random number. all my enemies get's instantiated at that one spot each game load. how can i generate a bunch of random of random numbers so, my spawnpoint, spawns at different, positions?
i suppose i could set 3 variable, which are equal to a Random,Range, i'll try that now.
Answer by AliAzin · Sep 12, 2010 at 11:22 AM
you should generate a random number each time you instantiate an enemy. like this:
for (i=0;i<5;i++){
var rnd = Random.Range(0,10);
Instantiate(enemy,Vector3(rnd,5,5),Quaternion.identity);
}
Your answer
Follow this Question
Related Questions
InvokeRepeating with a variable? 2 Answers
Random.Range affects the Random.seed 1 Answer
Random range choosing both results? 2 Answers
Random.Range changed in Unity 5? 2 Answers