I’m making a 3D platformer, and have ran into an issue. The goal is too collect all items on screen and reach the goal under a time limit. If you get hit by a hazard you go back to the start position. The collected items are still gone from the level, and the timer is still counting down from where it was, which is great. But my counter for the items collected before I got reset goes back to 0. Is there a way I can respawn and keep my counter from resetting?
Heres what I did for the respawn:
i used an array of references and respawned them hidden for something similar, but they were all children of the same base class so dont know if that is the same for you. Or you could just unpossess,set location(be sure to check teleport option) and then possess, that would keep everything too i believe
You need to store what the player has collected so far in the game instance or a save game.
When the player first loads, it looks in the save game ( or instance ), to see if any previously collected items need to be re-loaded.
Here’s stuff about the game instance and save game:
The difference between them is that the save game will be persistent even if you switch of the machine and come back to it later. The instance will only hold the progress during playing and re-spawning, which is maybe what you want.
If you need more help, show me a bit of code for coin collection and I’ll show you how to store and recall it.