- Home /
Menu scene not loading correctly, doesn't show particles or animations and buttons behave strangely.
Hello, here's my issue: I'm using the Game Jam Menu for my game Impossible Ships. I got it all up and running for my 1 scene on index 1 (the menu is on index 0) and i got it all working with the pause menu and everything, the issue comes when I tried to make a "Back to main menu" button.
I added the button to the pause menu and linked it to a function i added to the StartOptions script:
public void LoadMainMenu()
{
GetComponent<DontDestroy>().isDestroyed = true;
Destroy(gameObject);
Application.LoadLevel(menuScene);
}
The variable menu scene is set to 0, for that is the menu scene index.
Now when i play, go to the game, pause, and press the newly created back to main menu button, strange things happen.
Not only do all the particles in the main menu dissappear and are the animations gone, but when i press the start button, it stays on the "pressed" mode until i press another one.
All this is fixed when, in this state, i press the options menu and in it i press back, then it's all fixed.
Please help me, i'll post more code if needed.
Normal menu screen
Menu screen after starting game and coming back
Answer by OncaLupe · Oct 27, 2015 at 09:35 AM
I did a quick check of the game jam template, and noticed that that Pause script does a 'Time.timeScale = 0'. This causes Unity to freeze all animations and physics so that the game doesn't keep running in the background. You'll need to set this back to 1 to get the animations and such working again.
You can do this in the main menu in the OnLevelWasLoaded() method. The EventSystemChecker script has one, so if you still use that you can add 'Time.timeScale = 1' to it (probably right at the beginning, just make sure it's outside the if block), or put the OnLevelWasLoaded() method into any other script that would be in scene on load.
Hope this helps. :)
Oh wow thank you so much, truly appreciate it, I never even thought about the pause script, thanks for the help! +1 rep!