Cinematic Stealth Project — Loading Scene #13
Loading: 13%… Loading: 35%… Loading: 77%… Loading: 100%!

I’ve implemented a basic loading scene in my game, and it’s so easy that I want to teach you how to create one in less than 2 minutes. Starting now!
Create a new scene, with a canvas and an image which will serve as the loading bar. Be sure to set the type of the image as “Filled”.

Now, create a new script to fill up that bar and load a scene in the meantime. Name it something like “LoadingScreen”. Next, create two variables: an Image variable (the loading bar) and an AsyncOperation (used to load asynchronously the desired scene).

We’ll handle the Loading Behaviour inside a Coroutine. Because we’re dealing with an Asyncronous Operation, we need a way to check the loading progress.
- For our AsyncOperation, we’ll use SceneManager.LoadSceneAsync to create a new loading operation. Inside this method, you should input the scene you want to load (in my case, “Main” which is where the game takes place).
- Set “allowSceneActivation” to false. In case you want to do something before the scene is fully loaded and activated, this will help you do just that.
- While the progress is less than 90% (the other percent is when all the GameObjects in that scene have been successfully activated), update the loading bar fill every frame.
- Once the level has fully loaded, set the fill amount to the max (1), and wait 2 seconds (yes, some games add a little bit of delay before loading the scenes).
- And finally, set “allowSceneActivation” to true to start activating the scene.

And done!
