Application.LoadLevel() changes lighting for some reason?

I’m making a very simple game. Basically after the play misses three object, the game will reload the scene he was just on.

So i would use
Application.LoadLevel(“_Scene_00”);

However, for some reason whenever the game reloads _Scene_00, the lighting darkens dramatically.
I’m using a directional light, and even after the scene change it is still in the same spot.

Before:

After:

After building the game, everything is working again, so no worries.

To fix it in the Editor, go to Window → Lighting → Lightmap Tab → Disable Continuous Baking → Press Build to bake the lighting once manually.

Note that if you add more lights or make some changes, you have to bake the lightmap again.

Window > Lighting > Other Settings. Turn off Auto and press Build.

I’m having the same problem, it seems to be something to do with the global illumination, I have not found a fix, however the problem doesn’t seem to impact the build, just playing in the editor.
Trying building and running that, hopefully the editor will be fixed in a future patch or something.

In both of your scenes go to Window → Lighting → Lightmaps and disable auto and manually click Bake. Leave the auto checkbox off. Do this for both of your scenes, the start menu scene and your game scene. In both scenes the auto checkbox must be off and have a lightmap snapshot up above in the lightmap snapshot field.

In Unity 5.2.0f3, if you call DynamicGI.UpdateEnvironment() after scene has loaded in the editor, this will fix some of the missing GI.
I have implemented this workaround in a persistent (DontDestoyOnLoad) MonoBehaviour:

void OnLevelWasLoaded(int level) {
#if UNITY_EDITOR && (UNITY_5_0 || UNITY_5_1 || UNITY_5_2_0)
	if (UnityEditor.Lightmapping.giWorkflowMode == UnityEditor.Lightmapping.GIWorkflowMode.Iterative) {
		DynamicGI.UpdateEnvironment();
	}
#endif
}

I found out that sometimes when baking, the references mess up.
I have a MenuScene that has no lighting and a GameplayScene with all the stuff setup. After baking the GameplayScene, I noticed it gets darker when loading from MenuScene. After some playing around, I went to MenuScene >> Lighting >> “Clear Baked Data” and to my surprise, I saw the contents of GameplayScene lighting folder delete (?!?). I baked again and since then it’s been ok.

So, basically, open the scene from where you call Application.LoadLevel() and clear its baked data. Observe whether it deletes lighting files from your level scene’s folder. If that’s the case, hope this helps you.

To fix it on 2017.1.2f1 go to Window->Lighting->Settings->Scene Tab->Disable Auto Generate->Press Generate Lighting
103286-editorlighting.jpg

I’m having the same issue, I’ve come upon this after submitting a similar question.

After further inspection, I’ve found out that the shader of the (only) mesh I have in the scene is changing after level restart. The parameters are the same (it’s a standard shader), but the preview in the inspector is black instead of white.

I’d suggest you to check the shader before and after level restart, it might be an issue with Unity 5.

For me, it’s exactly the opposite. It works well in the editor, but when I go to the build, it darkens.

The solution for me was using baked lights, I created the lightmap and it works perfectly both in editor and build

I’m doing test projects right now, so it doesn’t bother me much, but I would like to make it work with the real-time ligtning.

As for checking the shader of the mesh, I can’t open Unity right now (not at home), I will look it up and tell you my results.

I am working on a procedurally generated platformer, and I had strange lighting issues. Baking the lighting didn’t work (for obvious reasons) but I found that going to the inspector panel of the light and changing Baking to “Realtime” instead of “Baked” worked for me. Hope this helps.

To fix it in the Editor, go to Window → Lighting → Lightmap Tab → Disable Continuous Baking → Press Build to bake the lighting.

I had similar issues when i used Application.LoadLevel() in unity 5.

Not sure what causes this, but i managed to fix it by using new UI:

using UnityEngine;

using System.Collections;

public class ChangeScene : MonoBehaviour {

public void ChangeToScene (string sceneToChangeTo) {
			Application.LoadLevel (sceneToChangeTo);
	}

}

Im not sure if i can help you anymore with this.