Splash screen in Unity – even on Personal Edition!

splash_screenAnother Thursday and another part of practical programming in Unity. Today we will show you how to create simple splash screen which precedes loading your application’s main scene. If you have Unity Personal Edition you can’t change starting image so it’s good to gently work around this limitation.

Creating your own splash screen has also some advantages:

  • scene with splash screen is lightweight so it loads itself quickly,
  • you can show additional informations on splash screen while user is waiting for end of loading,
  • splash screen loads quickly so user will see default Unity splash only for a few seconds.

In Unity 5.3 SceneManager was introduced. It provides LoadSceneAsync function which will be used in our splash screen. To fully understand how it works, you should be familiar with coroutines (read more here: Coroutines – the first encounter!). Our goal is to create something like this:

splash screen

As you can see we decided to create simple screen in Splash scene with loading text and dots added to it. After a few seconds, new scene is loaded. Script which implements all needed functionality is shown below:

We hope that everything is clear here. When Splash scene is loaded, LoadGame coroutine is fired. It loads new scene in the background. We can poll AsyncOperation object and check if it finishes its work. Yield return null is necessary to allow Unity to perform Updates in splash scene. Remember to remove first line in LoadGame function because it’s just for testing purposes.

It’s also imporant not to forget about adding all needed scenes in Build Settings:
splash screen

If you forget to add here Main scene you will see beautiful NullReferenceException in Console because SceneManager won’t be able to find this scene.

We recommend to build complete solution which can be downloaded from here: Download and see how it works on your device 🙂

See you next Thursday!