How to Create A Loading Scene in Unity

Objective: Create a new scene to show a loading bar while the actual game is loading.

The first step is to create a new scene. I called it “Load” and added the respective images, one for the background and another for the progress bar.

Now we have to change some properties in the progress bar images, the image type to “filled” and the filled method is “horizontal”.

With this configuration we can modify the value of the property “fill amount” and you can see how the bar moves forward and backward. We are gonna change the value of this property through code to show the loading progress.

I created a new script and added it to the canvas in the scene. Within the script I create a variable to store the reference of the progress bar image. Then I created a new coroutine to load the scene.

We have to create a variable of AsyncOperation type. It allows us to execute a function independently of the other processes and provides methods to check if the operation is done and the current progress. In this case we assigned the load scene to the variable and created a loop to check if the operation is done. While the operation is not done we just change the value of the filled amount of the progress bar to the current progress value.

Once the operation is done the game scene is going to be loaded.

And that’s it!!! We have a loading scene before the game.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.