Scene Switching problem. Scene becomes black when it changes
![alt text][1]I am making a game and when I try to have the game switch to the scenes the whole next scene is completely black. I can still see the outlines and my scripts work fine. This usually happens when I move scenes for the third time. If I go to edit the scene that turns black it is normal and plays normally. Can someone help me, please. My scripts and scene are posted My scene changing script is
using UnityEngine; using System.Collections;
public class MoveScene : MonoBehaviour {
public void ChangeToScene (string sceneToChangeTo) { Application.LoadLevel(sceneToChangeTo); } }
Answer by TBruce · Jul 19, 2016 at 11:28 PM
First Solve all your errors (Look at your error list).
Next, Application.LoadLevel is deprecated (Also in your error list). Instead use SceneManager.LoadScene(). See examples below
import UnityEngine.SceneManagement; // place this after #pragma line
SceneManager.LoadScene(nextLevel);
or
import UnityEngine.SceneManagement; // place this after #pragma line
if (SceneManager.GetActiveScene().buildIndex < (SceneManager.sceneCountInBuildSettings - 1))
{
SceneManager.LoadScene((SceneManager.GetActiveScene().buildIndex + 1);
}
else
{
// reload current scene
SceneManager.LoadScene((SceneManager.GetActiveScene().buildIndex);
}
Note: It is VERY important that all scenes are listed in the "Scenes In Build" list on the "Build Settings" screen.
And I forgot to mention this, from the main menu go to "Window\Lighting" and a window will pop up. There will be three tabs. It does not matter which tab you go to but to make explaining this easier select the last tab ("Lightmaps"). You will see a checkbox labeled "Auto". $$anonymous$$ake sure that it is unchecked an press the "Build" button right next to it.
The lightmaps worked just fine. I didn't need the scripts
Answer by husseincheayto · Nov 02, 2018 at 09:56 AM
have found a way to remove the black screen when switching between scenes in this link: https://youtu.be/lgby922jooA
Your answer
Follow this Question
Related Questions
Complicated level change problem 1 Answer
switch through switch cases forward and backward with pressing two buttons 0 Answers
Unity 2D Store on Different Scene? 0 Answers
Switching items - can't detect a crazy loop that is happening. 1 Answer
Problem with script in multiple scenes needing to refer to FPS Controller. 1 Answer