Application.LoadLevel is not destroying anything
Hi everyone,
Is there a checkbox or something that makes Application.LoadLevel don't destroy current Scene GameObjects?
I made a new game UIButton, and all it does is call this script:
public class LevelController : MonoBehaviour {
public void LoadLevel(string levelName)
{
Application.LoadLevel (levelName);
}
}
The Scene I call is loaded successfully, but the current scene is not being destroy... I didn't use Application.DontDestroy.... on ANY GameObject... so I really have no idea what is going on...
Any clues?
Use Scene$$anonymous$$anager.LoadScene, see if that works, Application.LoadLevel is obsolete
I'm Using Unity 5.2.0f3... Scene$$anonymous$$anager is from Unity 5.3... I'll Updateing Unity though... see if it fixes the problem...
Does the same happen with a new empty scene? Are you sure that the new scene doesn't contain or create this button of yours in some other way?
It shouldn't have done it before I Updated Unity. But after you mentioned it, I went to project settings, and you were right. Somehow the new scene became scene 0 which was being called by another Script...
Thanks...
Ok. I updated Unity to newest version, and now something wird happens.
When I play ANY scene, my scene with this button, gets added to current scene and below it, appears a Unity logo with the legend don't destroy on load...
Picture Attached..
Any Ideas on how can this happens and why?
You are using DontDestroyOnLoad on some object... Check every script!
Also, try that: Scene$$anonymous$$anager.LoadScene(levelnameornumber, LoadScene$$anonymous$$ode.Single);
Your answer
Follow this Question
Related Questions
UI element bug? 1 Answer
RectTransform Left Right Bottom Top 0 Answers
Scroll View Children not Behaving (UI Instantiated Prefabs not conforming to guide) 0 Answers
Weapon arsenal Inventory UI 0 Answers
Certain scripts that are attached does not work after build, scene change and closing unity 0 Answers