- Home /
SpriteRender's sprite not changing
Hi, I'm trying to change a spriterender's sprite inside of a clip by storing the new sprite in a dictionary then calling it. I'm doing it with the code below, and there are no errors called. However, the actual sprite in the spriterender doesn't change. The onmousedown part is being called, the sprite just stays the same. Any help would be appreciated, ty!
Answer by 3kWikiGames · Jul 03, 2018 at 12:16 AM
Since your for loop is in the Start() method it is only being called every time you begin the scene. Trying moving it down to the update method or a fixed update method to solve this problem of it not transitioning. Then if you would like it to move at a certain speed, have the variable i go back to 0, or create a timer with if statements within the loop to change when you need.