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!




Junior Unity Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Head First Java-Chapter 02

Data Platform from the group up-Setup Superset in production (High availability/Async) with…

Tracking the step by step of the “ls” command in the Shell

The Shell prompt from the user intructuctions (commands) to communicate to the core of  system

How to open SQlite3 Database in VsCode in Ubuntu

5 Elements of High-Quality Software

Seedr review

Blocksite-Way to achieve more in less time with BlockSite’s ‘Scheduling’

Agile Introduction

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
Pablo Gómez Platón

Pablo Gómez Platón

Junior Unity Developer

More from Medium

Editing FBX Files

Adding a wave system to our prototype

2.5D P1 Framework: Complete!

Working with Unity’s 2D Tilemaps