How to Create a Loading Scene in Unity

Calum Slee
3 min readSep 4, 2021

Most games have loading screens, allowing the engine time to populate the scene with everything needed, but by default, these don’t exist.

To create a loading scene, we can create a new Scene, and dress it up as we wish.

Unity’s Scene Management, allows us to load our next scene Asynchronously. This means that we can stay on our current loading scene whilst our main game loads simultaneously in the background. We can create a LoadScene script and call the following function: SceneManager.LoadSceneAsync(“Main”);

To create a visual response for the user, we can create an overlay bar. In our Image tab, we can manipulate the fill method. This allows us to scale our image across the screen on a scale from 0 to 1.

In terms of creating functionality around the Async loading. We can make use of a Coroutine, and assign our Async to an Async Operation variable.

Now with a reference to our image, we can assign the fill amount of our bar, to the progress variable of our Async Operation. This runs every frame while the isDone variable is false.

Our loading scene now works, but personally, I could only just discern this, as my PC seemed to load the main scene very very quickly. While we could create an artificial delay using WaitForSeconds, this could cause long load time issues with other users.

Instead, we can introduce something along the lines of “press x to continue”. To do this, I created an instructional image with text, and could then enable it on isDone = true. Firstly, we need to prevent the scene from loading on completion.

We can set the allowSceneActivation bool to false. Then in our while loop, we can check if our progress is greater than 0.9, if so, we can set our instruction active, and run a check for input. In this case, if the spacebar is pressed, allowSceneActivation is set to true, allowing our main game scene to now be loaded.

--

--