Keeping track of the previous scene
In my game there are multiple different scenes that the player can walk through. (ex: Level 1, Level 2, Level 3).
Based on the previous scene that the player came from, I want them to be positioned at a certain place in the level (ex: If coming from Level 3 into Level 2, they will start at the end of Level 2 vs. Coming from Level 1 they would be at the beginning of Level 2).
How would I keep track of the previous scene that the player comes from when I load each scene? Any help would be appreciated!
Answer by tormentoarmagedoom · Apr 26, 2018 at 12:50 PM
Good day.
You should create a object with DontDestroyOnLoad property in a scene before changing scene. Store in that object a string variable with tje current level name.
Then change scene, and will still have the last scene name stored in that object. You only beed to read it, destroy the object, and create it again with the new scene name (fpr the next scene)
If dont know how to do it, look it in google and manuals, is veri simpme.
Please accept the answer and close the question! Buee?
Your answer
Follow this Question
Related Questions
Save and load scene from file 2 Answers
Loading and Unloading scenes 2 Answers
Why is my scene not loading? 2 Answers
Multiple active scenes updating but not rendering? 0 Answers
Unable to get name of current scene 0 Answers