Multiple Sprites, One Script, Randomization
Hello,
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.
Answer by TheCrownedPixel · Jun 05, 2020 at 04:34 PM
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.
Your answer
Follow this Question
Related Questions
Sprite mouse movement Unity2D 0 Answers
[SOLVED] Problems creating a Sprite through script 0 Answers
Shader invert sprite colors 2D 1 Answer
How to make 2D physics objects graphics? 2 Answers
Inverse Sprite Maskin 0 Answers