Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Bissmark on October 25, 2013, 05:38:45 AM

Title: Game Over Menu back to Start Menu problem
Post by: Bissmark on October 25, 2013, 05:38:45 AM
Hi, I am quite new to NGUI

I am trying to create a Game Over menu which works fine. I quit back to the main menu
But when I try and play the game again I get errors saying that items have been destroyed

Please help
Title: Re: Game Over Menu back to Start Menu problem
Post by: Nicki on October 25, 2013, 04:03:36 PM
Have you tried not destroying those game objects..? :P

It sounds like there's a problem with how you're handling a game being over, so things that were destroyed during the game or when it finished aren't re-initialized or remade when you want to play again.
Title: Re: Game Over Menu back to Start Menu problem
Post by: Bissmark on October 26, 2013, 01:00:13 AM
I do not actually believe I delete the objects, I thought that they just got deleted when the scene changed back to
the menu. At the moment on game over everything gets disabled and then enabled again on game start. I am frantically trying to find if the objects are destroyed somewhere but there isent that much code to work through and I cannot find it anywhere.
Its easier for my retry button because then it doesnt have to change scenes, it can just trigger the gamestart again and work from there.
Title: Re: Game Over Menu back to Start Menu problem
Post by: Nicki on October 26, 2013, 05:40:52 AM
Ok, well, anything that isn't marked as DontDestroyOnLoad in the scene will be destroyed when the scene changes http://docs.unity3d.com/Documentation/ScriptReference/Object.DontDestroyOnLoad.html

I'd recommend you set the root object of your UI to be that, so it persists.
Title: Re: Game Over Menu back to Start Menu problem
Post by: Bissmark on October 26, 2013, 05:58:36 AM
I have tried to use DontDestroyOnLoad before but it seems that the error comes before the awake function
so when I use DontDestroyOnLoad on my player, then i get more problems because it duplicates