Scene loading problem

Hi, I’m creating a mobile game. I’ve currently three scenes:

  1. Main menu
  2. Level 1
  3. Level 2

And a script which load a level when the player press a button. When I load the scene for the first time everything is ok BUT, if I came back to the main menu and select another level, the main character and the enemies doesn’t move until I use the pause button and the resume button.

This strange problem does not appear if I reload the current scene. It appears only if I make the following actions sequence

Main menu → level (1 or 2)
Level → main menu
Main menu → level (doesn’t matter which one of the two)

To load the scene I use SceneManager.LoadScene()

Solved. The problem was that when I pause the game I set the time to 0. Then, if I come back to menu the time is still 0. It changes if iI press again pause and then resume which put the time to 1.

Have you used “DontDestroyOnLoad” anywhere? Loadscene should reset everything to how you have the scenes in the editor. But “DontDestroyOnLoad” can be used to maintain data across scene loading. Maybe you have some parameters in there that need to be reset by script as you change scenes?

The problem then is not the loading scene itself. When a scene is load, Unity destroys all the object of the scene, then instantiate al objects of the new scene (exept for that objects with “DontDestroyOnLoad” property).

Are you using the DontDestroyOnLoad somewhere?.

When you say press de paise button you mean the Unity pause button at the top of the script? You should debug ypur code and see whats the satate of all scripts and variables.

Post what you find

This is a problem with the implementation of your pause button - not with the scene loading itself. Mind posting the pause button’s pausing code?

I just wanted to give my experience with this as well in case others stumble upon this thread (This is a highly suggested thread on Google based on the search criteria).

In my case when I was returning to the “Menu” scene from “Level1” I found two entries for the Menu scene in the “Hierarchy” window.
One Menu scene is loaded and active, and there is a second one stuck on status “is loading”.
When trying to open more scenes they will end up having stats “is loading” as well.

I fixed it by finding the duplicate “Menu Scene Loader” in the Level scene and removing it.

Hopefully this helps someone.