Search code examples
imageunity-game-enginescreensplash-screen

Unity short Black Screen after loading first scene


Scenes:

1.Splash, one image with the IEnumerator Start() code as described below.

2.Menu, Canvas UI with a few buttons and a some gameobjects in the scene as background. Camera has a tonemapping and depth of field script.

Stats: Batches 96, tris 20.4k, 41.5k

3.Main Main scene of the game.

Bug, happend on android device and on pc in the editor:

1.Splash scene loads the menu scene using:

IEnumerator Start()
{
    AsyncOperation async = SceneManager.LoadSceneAsync("Menu");

    while (!async.isDone)
    {
        yield return null;

    }
}

2.The canvas UI of the Menu scene appears with a black background, the gameobjects in the scene are not visible, for a few seconds.

3.The canvas UI + the scene is visible.

Same bug happens when the Menu scene is loaded from the Main scene.

Unity version = 2017.3.0f3 Using vuforia in the main scene.

EDIT:

I disabled all the objects and camera effects in the Menu scene except for a plane and the canvas, the canvas still appears a few seconds before the plane.

To describe the bug better, the camera seems to active a second after the canvas UI is shown.

EDIT2:

I created a new camera in the menu scene and the problem still persists.


Solution

  • I found my fix by adding an AR camera to the scene and disabling the the VuforiaBehavior component which was making the black screen when the scene was loading.