- Home /
This question was
closed Sep 09, 2014 at 08:21 AM by
fafase for the following reason:
The question is answered, right answer was accepted
One script, different variable for each object.
Hello, I'm trying to make script for birds and I want each bird to fly in random direction, but they all fly in the same direction. Here is the script:
string direction;
void Awake () {
if (Random.Range(1,2) == 1)
{
direction = "up";
}
else
{
direction = "down";
}
}
Comment
Best Answer
Answer by tanoshimi · Sep 08, 2014 at 03:33 PM
That's because Random.Range(1,2)
will always return 1....