- Home /
https://answers.unity.com/questions/919940/applicationloadlevel-changes-lighting-for-some-rea.html
Light Problem after loading the scene
Hi,
I´ve got a problem with the light in my scene. Wenn I die in the game, I load the scene with
Application.LoadLevel(Application.loadedLevel);
new.
But after that, the scene is much darker.
Here are two pics to compare.
I can't find any difference. The directional Light component is exactly the same than before.
Are you using DontDestroyOnLoad anywhere? And how is the scene is first loaded? Are you playing it straight from the editor or do you have a Title screen scene that loads this scene with LoadLevel / LoadLevelAdditive? I ran into this issue once before when the scene was being loaded additively, doesn't seem the case here. Looks like the ambient lighting properties are changing, not sure why though. (Window -> Lighting)
Wow, that's odd... I have to agree with Jessespike, it's probably something in the Ambient settings... Are you maybe using a skybox as the ambient source in one but it's not carrying over in the reload?
The only other thing I can think of would be the Sunlight field in the Lighting settings... It should be set automatically to the brightest light in the scene, and I believe it's used for the realtime GI, so you might want to check and make sure it's getting set properly when loading the scene.
The only really odd thing I noticed is that the sky does not appear to darken in the game view, but it does in the editor view (or is that water below the level?). Are you using a lit shader for the sky?
does it happen in the build game? unity has some funky light setting in the editor. every time i go to a new level the light in that level is messed up, but only in the unity editor the build is fine.
Answer by kavanavak · Jan 22, 2018 at 04:23 AM
This is kind of old now, but..
Go to Window/Lighting/Settings (DebugSettings) and unCheck "AutoGenerate".
You will have to manually regenerate the baked lightmap when you make changes, but this will allow unity editor to show the scene as you want it, post loadScene.
Answer by ThisTestWillDo · May 03, 2016 at 11:42 PM
It's just a common part of the way the scenes are pre-loaded in the build verses Unity. When the game is built, this problem will not exist, so it's nothing to worry about.
Answer by SQ_11 · Jan 22, 2018 at 08:04 AM
Check if there is any "Don't DestroyOnLoad" is calling. Comment or remove it and check again.
What do you mean by this? Why would a problem happen if a DontDestroyOnLoad is calling something?
Follow this Question
Related Questions
Using Lightning to light up a dark 2d level 1 Answer
Light gets darker after loading another scene 2 Answers
Dark light cookie 1 Answer
Normal map in dark 1 Answer
Lighting only happening when the player get close. 4 Answers