Answer the question
In order to leave comments, you need to log in
How to restore some of the objects on the stage during the "rebirth" after death (platformer 2d)?
When dying, the character is teleported to the rep. The level itself should roll back to its original state, except for all the coins taken (objects with the Coins tag).
I see two ways - to somehow implement it through loading the level with parameters, or to store data about all changes on the stage and roll them back when reborn.
Can you please tell me how to do it better? Or, if both methods are not a cake, tell me something more suitable.
Answer the question
In order to leave comments, you need to log in
You somehow need to store information about the changes made somewhere. The easiest way is to create a component (CoinCollect) that you can make indestructible when reloaded using DontDestroyOnLoad and enter a list of the coins you have picked up into it. And when generating coins on restart, it is worth spawning only those that you did not pick up by referring to the list from this component (CoinCollect).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question