- Home /
Proper way to use scenes
I am making a game where when the player finishes a random generated level can go to the next random generated level with more rooms. How can I pass an information from te previous scene to the next? Why I should? Wouldn't be better if I just destroy the current map and generate a new one than move the player to the startin position and hide it with a loading screen image in the canvas? What is the porpus of the scenes if I can just drag and drop everythin (what I want) into a prefab and instantiate it. When should I do this and when should I change scene?
Answer by rh_galaxy · Nov 04, 2020 at 12:55 PM
I can only speak for how I do it in my game. I have two scenes, a Menu and the Game. The game scene generates the level I want to play. So I have 55 levels, the menu is always loaded between levels, then you choose a new level and load the game scene and repeat that. I have a GameManager class/object that is kept between scenes (a singleton do not destroy object), that keeps all variables that's needed and runs the game state machine that switches between Menu scene and Game scene.
That's how I would suggest you organize your game, you could just load the same scene again (and generate a different level) and not going back to the menu after each level. But there are many ways to do it...
Your answer
![](https://koobas.hobune.stream/wayback/20220613015144im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Player controlled prefab not moving in new Scene 1 Answer
Passing array of prefabs to next scene 1 Answer
Save & Load Game question 3 Answers
Movement in my terrain ? 2 Answers