Multiple Sprites, One Script, Randomization


Having a bit of trouble with script instancing (?! I may have made that up.

So I have multiple sprites, and I have a piece of script that slowly changes the last color value (Color(1,1,1,X)), to change the translucency of the sprite. I wanted each sprite to be independent of each other. I have a randomizer in the script (which works) that changes that starting X value for each sprite.

What happens at the minute is that all the sprites change at exactly the same time.

Thank you for your help.

Figured it out.

Unity.Random always executes the same, so all the scripts were getting the same random number.

System.Random makes the units different, so each sprite was then accessing a different random number, solving the problem of “instanced” scripts.

Learn something everyday.