Ok, first off I’m a Unity noob and only somewhat experienced with programming in general, AND I’ve been awake for ~30 hours. This is probably a dumb question but I can’t figure out what the problem is. The code is:
function Start () {
var x : int = Random.Range(0,11);
print (x);
}
I want this to make one random number (0 through 10), store it in x, and print it to the screen. One time. I’m using it as part of a bigger script obviously, but everything else is commented out.
It prints 60 numbers instead of just one, and it’s really screwing up my stuff. I thought the things in the start function only executed once? When I put it in Update, it just keeps spamming numbers, and when I make it its own function, I still have to call it and it does the same thing. Any help would be appreciated, this is driving me crazy and it seems so simple.
Could it be that that script is attached to 60 objects?
– UnitraxxThat's it, thank you! It was attached to my 55 space invaders, running once for each of them. I knew it was gonna be something simple like that.
– abrackYep. Tired. :)
– Negagames