Hello Guys, I downloaded Unity 4.20 yesterday and started a new project with NGUI free version downloaded from www.tasharen.com and faced few problems. Challenges Button Code Code (csharp): using UnityEngine; using System.Collections; public class ChallengesButton : UIButtonSound { void Start () { } void Update () { } void OnClick () { if (enabled trigger == Trigger.OnClick) { Destroy((Object)GameObject.Find("MainMenuScreen")); Application.LoadLevel("ChallengesScreen"); } } } Challenges Screen Menu Button Code (csharp): using UnityEngine; using System.Collections; public class ChallengesMenuButton : UIButtonSound { void Start () { } void Update () { } void OnClick () { if (enabled trigger == Trigger.OnClick) { Application.LoadLevel("MainMenuScreen"); Destroy((Object)GameObject.Find("ChallengesScreen")); } } } Note : I apologize for the odd spaces but I do not know how to remove them as I even tried with small png images I even tried putting Destroy() before LoadLevel() but still it didn't work. Funny thing is, the same code worked for all the buttons on the main menu screen but for the Menu button of Challenges, Options, Customize Training screens, the code doesn't destroy the previous scene. Please help!!!
1. For NGUI questions you should post them into the NGUI forum. 2: Maybe thats the problem , a 1 Jear old tool is probably incompatible to Unity 4.2.
As simple as your GUI is, there is really no reason not to use the built-in GUI system in Unity. http://docs.unity3d.com/Documentation/Components/GUIScriptingGuide.html http://docs.unity3d.com/Documentation/Components/gui-Basics.html http://docs.unity3d.com/Documentation/ScriptReference/GUI.html