How to Pause a Scene, Enter Another and then Re-enter and Continue From Said Paused Scene?

Essentially, I have a game which will enter a ‘bonus’ state (very much like the pipe area in Mario with all the coins you can collect) midway through the scene (or whatever will activate it), and then I want the game to place you back in where you left off.

I’m not sure how to go about doing that, apart from making all the required gameobjects/scripts DontDestroyOnLoad, which would then end up running over to the next scene. Also there is a lot going on in multiple scripts to start adding lots of PlayerPrefs to every variable.

Is there not a way to pause a scene, load another and then when you exit that state you can enter the previously paused scene? The only other solution I can think of is to just do the ‘bonus’ state all in the same scene… probably the easiest way.

Any help on the matter will be much appreciated, thanks!

Use a static variable to store what scene you were on before entering the bonus area, and your x-y-z coordinates. When you exit the bonus area, load the previous scene from your static variable for the scene name, and position the player at the stored x-y-z.

If there’s other changes in the level you need to track, you’ll need to store those as well,