Using LoadLevel has effect on light [duplicate] - unity3d

This question already has answers here:
Objects in Scene dark after calling LoadScene/LoadLevel
(7 answers)
Closed 5 years ago.
I am making a simple orthographic game in Unity, where the player has to shove a puzzle to open a door leading to the next room. The problem is, that when I enter the door, and the next scene is loaded using LoadLevel(), the light gets darker than it would normally be. This does not happen if I edit the scene inside Unity and start testing from there. I am wondering what happens, and how to fix it. I have even made a prefab of the Directional Light that lights up the scene to make sure they are equal, but that has no effect. How do I fix this?

This is normal. It happens in the Editor only and also when Continuous Baking is enabled. This will not be present when you build your project.
To fix this in the Editor, Window -> Lighting -> Lightmap Tab -> Disable Continuous Baking then click on the Build button to bake the lighting.
If using Unity 5.4, the settings changed a little bit Window -> Lighting -> Lightmap Tab -> uncheck Auto checkbox. Click on the Build button to bake the lighting.
If you move, remove or add objects in the Editor, you must rebake/build lightmaps again.
EDIT:
This has been renamed to Auto-Generate. See duplicate for new answer. This answer will remain for older version of Unity.

Related

Light in the scene window got way brighter after upgrading to Unity 2018.2.18f1 but the game window shows light correctly

So I had a project that I created using unity 2017.3 now I decided to move to Unity 2018.2.18f1 and notice a very annoying problem that I can't seem to solve,
the lighting in the scene window got way too bright on the other hand in the game window even before hitting play it shows the correct light. here is an image of the issue:
I tried everything out there that worked on past versions with no results, trying removing auto generate and generating the lightmap manually, tried to change the reflection source from skybox to custom didn't work.
although in the game it self the light is correct so it didn't really break the project but it is really annoying designing levels this way
any insight on this would be great.
Sometimes, issues occur when upgrading a project to another Unity version. If the issue is related to lighting do the following in order:
1. Delete the lights in the current scene then create new lights. For some reason, there seems to be light issues carrying it's settings to the new Unity version and creating new lights usually fixes it.
2. Go to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.
3.Go to Assets --> Reimport All.
4. If everything above did not work, go your Project's Library folder then delete it. Restart Unity.

Scene gets darker after redirection Unity 3D [duplicate]

I completed Unity's roll-a-ball tutorial and it works fine. I changed a couple of materials to make it look better. I also added a C# script that should restart the level when the player falls off of the ground (I disables the walls). I am using Unity 5.5.
It initially looks like this:
But when I go off the edge and the level restarts, it looks like this:
It sometimes looks like this for a few seconds after opening unity when the editor is loading.
Here is the script:
using UnityEngine;
using System.Collections;
public class DeathTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.CompareTag("Player"))
Application.LoadLevel(Application.loadedLevel);
}
}
Any ideas on what's causing this?
The colors and materials are loaded. This is a lighting problem because lighliting is still calculating in the background. This will likely occur in the Editor only. This should not happen in the build.
Depending on your Unity version, you can fix this by going to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.
For older version of Unity with no Auto Generate checkbox, see here.
After play with Lighting tools, only one thing should be change on Lighting Setting for every scene.
Window > Rendering > Lighting (Unity 2020)
Click at Environment Tab
At Environment Lighting, change Source from Skybox to Color.
Select white color from Ambient Color.
Done. Try test it.
Before
After
I found many solutions online but I was missing out a step, so I hope this helps.
Most solutions indicated to go to Windows->Lightning, then untick Auto and Click Generate Lighting. My problem was that while I was pressing the generate button I did not have all of my scenes loaded for preview (at least not the scene I had problems with), so it was only applying light generation to the loaded scenes. Make sure all scenes are loaded when generating the lights.
Try Clearing Baked Data if you are using unity version around 5.5
Go to Windows->Lightning->Untick Auto->Now Click dropdown arrow of Build Button which is near Auto(Check Box) -> Select Clear Baked Data.
Now try Your code which looks fine although SceneManager.LoadScene (1); is enough.
Also unloading the previous scene and setting new scene as active scene is a good practice.
This worked for me.
File > Build settings > player Settings > (on the left) Graphics > (Top-Right) gear icon > Reset
I'm a newbie and none of the advice on web helped me. However when I went to Window > Rendering > Lightning > scene tab; If "lightning setting" says “none”, click on it and choose “demo”- setting. Press “generate”.
So it seems like it was missing settings all together which made the scene go dark when loaded.
I encountered the exact same problem. What worked for me was to set Directional Light > Light > Mode to Realtime. (it was Baked, for some reason)
I hope this can help someone in the future.

Scene is darker when playing in editor [duplicate]

This question already has answers here:
Objects in Scene dark after calling LoadScene/LoadLevel
(7 answers)
Closed 5 years ago.
I have a menu scene which goes to the game scene by calling SceneManager.LoadScene method.
Everything is alright when I build the game and play (or play in editor starting from the game scene).
But when I play the game in the editor (starting from the menu) the game scene is darker than usual.
That's not hurting me, but I'm curious to know the reason.
By the way, I have only the one default directional light which unity creates.
Screenshots:
Normal (Playing the game after build)
Darker (Playing the game in editor starting from the menu scene)
You have to disable the contious light baking.
In order to do so in Unity 2017.1, go to Window -> Lighting -> Settings and uncheck Auto Generate at the bottom of the window. Then, press Generate Lightning to bake the lighting once manually.
Note that if you add more lights or make some changes, you have to bake the lightmap again.

Unity 3d scenes comes "gold" [duplicate]

I completed Unity's roll-a-ball tutorial and it works fine. I changed a couple of materials to make it look better. I also added a C# script that should restart the level when the player falls off of the ground (I disables the walls). I am using Unity 5.5.
It initially looks like this:
But when I go off the edge and the level restarts, it looks like this:
It sometimes looks like this for a few seconds after opening unity when the editor is loading.
Here is the script:
using UnityEngine;
using System.Collections;
public class DeathTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.CompareTag("Player"))
Application.LoadLevel(Application.loadedLevel);
}
}
Any ideas on what's causing this?
The colors and materials are loaded. This is a lighting problem because lighliting is still calculating in the background. This will likely occur in the Editor only. This should not happen in the build.
Depending on your Unity version, you can fix this by going to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.
For older version of Unity with no Auto Generate checkbox, see here.
After play with Lighting tools, only one thing should be change on Lighting Setting for every scene.
Window > Rendering > Lighting (Unity 2020)
Click at Environment Tab
At Environment Lighting, change Source from Skybox to Color.
Select white color from Ambient Color.
Done. Try test it.
Before
After
I found many solutions online but I was missing out a step, so I hope this helps.
Most solutions indicated to go to Windows->Lightning, then untick Auto and Click Generate Lighting. My problem was that while I was pressing the generate button I did not have all of my scenes loaded for preview (at least not the scene I had problems with), so it was only applying light generation to the loaded scenes. Make sure all scenes are loaded when generating the lights.
Try Clearing Baked Data if you are using unity version around 5.5
Go to Windows->Lightning->Untick Auto->Now Click dropdown arrow of Build Button which is near Auto(Check Box) -> Select Clear Baked Data.
Now try Your code which looks fine although SceneManager.LoadScene (1); is enough.
Also unloading the previous scene and setting new scene as active scene is a good practice.
This worked for me.
File > Build settings > player Settings > (on the left) Graphics > (Top-Right) gear icon > Reset
I'm a newbie and none of the advice on web helped me. However when I went to Window > Rendering > Lightning > scene tab; If "lightning setting" says “none”, click on it and choose “demo”- setting. Press “generate”.
So it seems like it was missing settings all together which made the scene go dark when loaded.
I encountered the exact same problem. What worked for me was to set Directional Light > Light > Mode to Realtime. (it was Baked, for some reason)
I hope this can help someone in the future.

Unity 4.5.5f1 shadows not appearing

I recently downloaded Unity and am working my way through a couple of the beginner projects just to get a feel for the environment. I ran into a problem, though - when I apply directional lights to the scene shadows aren't appearing. I've tried switching to hard shadows, ensuring that I don't have more than one directional light throwing shadows, ensuring that I'm using DirectX 11, forward lighting, making sure in Player options that shadows are allowed, checking the hardware specs required to run shadows in Unity - basically everything that's been suggested in other questions. Has anyone else ran into this problem? How did you fix it?
Edited: Ok, I kind of fixed it, but in a really strange way. After a bunch of searches, apparently DX11 doesn't play nice with Unity on Windows 8.1, so I've gotta use the command prompt, -force-d3d9, create a completely new project, and then uncheck the "Use DirectX 11" button.
Further update: After messing around with that for a bit, apparently if I close Unity at any point while doing this it refuses to open the project without DirectX 11 enabled, even if I force DirectX 9. If I don't force DirectX 9 and just open the project, none of the things I'd put in the scene appear. So, basically what I've discovered is that to get shadows, I've gotta create an entirely new project and then never close Unity ever at risk of losing it. Any further help is entirely welcome.
I had a similar problem, switching DirextX 11 off to show shadows then Unity crashed. I opened Unity again, luckily my scene could be restored, but DirextX 11 still stayed enabled.
What I did was just hid "Scene" and "Game" panes by showing other panes ("Animator" and "Console", to be precise) so that any graphics wouldn't be refreshed on screen when I switched DirectX 11 on/off. Doing so, Unity didn't crash, but as soon as I displayed "Scene" pane, Unity crashed immediately. So without displaying graphics I saved my scene/project, closed Unity, and opened it again then I could edit my scene with DX11 disabled.
Well, this might be a voodoo thing, but just for sharing my solution.