Question by
DudeInaScarf · May 24, 2016 at 08:06 AM ·
arrayrandom.rangefor-loop
Randomly enable objects, need help
Hello, i have spinning wheel, when it's stops, random character should be enabled. But when i execute the script, always enables only first character. Here is the sample:
for(int i = 1; i < SaveLoadData.instance.characters.Length; i++) {
SaveLoadData.instance.characters [Random.Range(1, i)] = true;
}
Thank you.
Comment
Best Answer
Answer by Nazirzadeh · May 24, 2016 at 08:35 AM
Check Random.Range; It returns a random integer number between min [inclusive] and max [exclusive]