Are we there yet? — How to create a loading bar in Unity
In this quick article I will go over how to create a loading bar in Unity.
I have a main menu scene built , with a background, title image and two buttons (start and quit). It will be the start button loads our loading screen scene (which is the scene in between the many and main game scenes).
On the loading screen I have created a simple script which calls the coroutine LoadingBarRoutine”. The coroutine changes has as variable assigned to the loading progress of the scene. We use the method LoadSceneAsync to achieve this. Every frame we pass the progress into the fill amount of our image and loop while the loading operation is not completed.
We can set up the images now in the scene. I have small scene prepared already with a background for the loading scene.
What we will do is an image to represent our progress bar and assign our loading progress to it.
All left to do is test it. Please note that the screen will load fairly quickly in this instance as the scene we are loading into isn’t too heavy on resources.
That’s all for now.