I have an animator switching blocks soon as the player hits them as an checkpoint. I am restarting the scene, if the player dies and spawning it to the checkpoint platform, thus I want to keep the checkpoint platform lit while the player has lives left. I am trying to do this by two Lists and checking the index, if its a match then change the sprite of the block in the start() method. Here’s the code:
public List Blocks;
public List BlocksLitSprite;
void ChangeBlocksToLit() {
for (int i = 0; i < Blocks.Count; i++) {
if (Blocks.IndexOf (Blocks _) == BlocksLitSprite.IndexOf (BlocksLitSprite *)) {*_
Blocks .GetComponent ().sprite = BlocksLitSprite*;*
* }*
* }*
* }*
For some reason it’s not changing the sprites. Any suggestions? Thanks!