I have a system in place to delete the previous level’s checkpoint save game and transport the player to the next level while saving their score, and it has worked fine for 9 levels, but I checked it with print strings and for some reason on this level in particular the cast to my Checkpoint save object is failing. The checkpoint name is spelt correctly everywhere it appears, and the game is being saved under that checkpoint when the player opens the level, so there will always be one saved when the player reaches the new level gate. It’s really confusing me why it’s been working fine for 9 levels and suddenly doesn’t, especially when it’s the cast to the save object that’s failing.
If it wont cast to your checkpoint, are you sure the slot name is the same?
Surprisingly seeing this actually really helped lol, it made me look for a reason why the save slot wasn’t there, and it turns out the code that was supposed to make a checkpoint 8 if a checkpoint 8 didn’t already exist, was instead checking if there was a checkpoint 5 and creating a checkpoint 8 if checkpoint 5 didn’t exist.
There’s only two reasons that cast can fail:
-
There is no save game
-
The save game in the slot is not a checkpoint save game.