With the introduction of the Game Session that re-loads the active scene on death, I have lost the ability to keep the level state the same between player deaths.
Notably I have state on the player (last checkpoint), and in-game triggers (things player does that affect the contents of tilemaps) that I want to preserve between deaths. Other things make sense to reload (such as enemies.)
I have already tried things like setting DontDestroyOnLoad on gameobjects I wish to preserve, then adding back to the current scene after it loads (using LoadSceneAsync and yielding until it is done), before moving the object back to the active scene and destroying the new copy from the load, but it just doesn’t work.
Any suggestions? Thanks!
I’m also curious when to use this pattern of Singleton (attaching the script on a game object in every scene, destroying dupes) vs using a classic static instance of the script.