- Home /
Application.LoadLevel(); Changes lighting
Hello. I am making an ios game, and I tried to create a script that changes scenes. It does, but, when it changes the screen, It deletes the light, even though I do have one in my build. Basically, I can not find my light anywhere in the hierarchy, cannot see it in scene mode, and the screen turns meshes black. I do not know why unity deletes the light. Does the error in the light mean anything, and, if so, how do I fix it?
Sorry, unity won't allow any more attachments, but, when you switch scenes, the light disappears. It really disappears, I am not being hasty. It is not in the hierarchy, I cannot see the gizmo, nothing. The meshes turn black. Please help me out. Thanks!
Answer by UCS3D · Aug 20, 2015 at 01:20 PM
The light is a gameobject and gets deleted when you change scene. You can use the DontDestroyOnLoad call to counter this:
http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html
Thank you! $$anonymous$$an, you are good! Why was it destroyed? Was it a quirk of unity, or some setting?
This always happen when you load a new scene. Everything without DontDestroyOnLoad gets removed.
Unless you load the next scene additively to your old scene.