Objects in Scene dark after calling LoadScene/LoadLevel

14,801

Solution 1

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.

enter image description here

For older version of Unity with no Auto Generate checkbox, see here.

Solution 2

After play with Lighting tools, only one thing should be change on Lighting Setting for every scene.

  1. Window > Rendering > Lighting (Unity 2020)
  2. Click at Environment Tab
  3. At Environment Lighting, change Source from Skybox to Color.
  4. Select white color from Ambient Color.
  5. Done. Try test it.

Before

After

Solution 3

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.

Share:
14,801
Johnny Dollard
Author by

Johnny Dollard

Stanford Class of '24

Updated on July 23, 2022

Comments

  • Johnny Dollard
    Johnny Dollard almost 2 years

    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: Screenshot of Initial Level

    But when I go off the edge and the level restarts, it looks like this: Screenshot of Reloaded Level 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?

  • Ryan Tensmeyer
    Ryan Tensmeyer over 2 years
    This didn't work for me at first, but then I realized that it's not a global setting and you have to be switched over to the correct scene. After changing to the correct scene, this worked great! Thanks!