Loading Scene

Overview

Initializing SDKs and loading dynamic data in a Loading Scene is mandatory before entering your main game scene. This helps separate initialization code from game code and prevents race conditions by ensuring all SDK dependencies are loaded before the game code attempts to call or reference those services.

LionSDK provides a loading scene that you can use out-of-the-box.

Features:

  • Display the new animated logo of LionStudios (optional)
  • Display the logo of the developing studio (optional)
  • Initialize all SDKs

Example

Setup

The Loading Scene can be automatically set up using the Setup Wizard.

Settings

  • Use Second Logo - This menu option enables/disables showing your company logo on the splash screen.

Example of a second logo

  • Second Logo Length - The second logo features a fade-in effect. This variable determines how fast or slow the image takes to fade in. By default, this is set to 1.5. (The larger the number, the slower the animation is).
  • Second Logo - Insert your sprite image here to display your company logo. The recommended dimensions for the image are 512 x 512.
  • Force Load After Timeout - The Lion splash screen waits until all classes using the ILionSDK interface are finished initializing before loading the next screen (More info in Add custom initialization code section below). If an issue occurs or an SDK takes too long to initialize, this option moves the game to the next screen regardless of whether all initialization of third-party SDKs is done (Initialization of these ILionSDK classes will still continue).
  • Force Load Timeout - This variable determines how long the splash screen will wait before loading the next scene if the “Force Load After Timeout” option is enabled.
  • Use Async Loading - Depending on the type of data in your main game scene, the loading time may be better with or without async loading. You can test on the device to see what works better in your case.
  • Disable Lion Logo - Enable this if the game is still in Soft Launch and not in Lion Studios account

Modify second scene

To override which scene should load after the loading scene, you can use the LoadingSceneManager.SetSceneToLoad method.

Here is an example:

public class SecondSceneSetter
{
	[RuntimeInitializeOnLoadMethod]
	void SetSecondScene()
	{
	     // Example 1: Set the scene to load using the scene name
	    LoadingSceneManager.SetSceneToLoad("NextSceneName");

	    // Example 2: Set the scene to load using the scene index
	    LoadingSceneManager.SetSceneToLoad(2);
	    
	    // Example 3: Set a different scene to load depending on a condition
	    LoadingSceneManager.SetSceneToLoad(IsFirstSession ? "FTUE" : "NextSceneName");
	}
}

Add custom initialization code

If you want to add additional initialization code to this Loading Scene, you have to implement the ILionModule interface.

The ILionModule interface is a part of the Lion Studios Core package.

Classes implementing this interface are automatically detected and initialized during LionCore initialization.

using System.Threading.Tasks;
using LionStudios.Suite.Core;

public class CustomModule : ILionModule
{

    // Determines in what order ILionModules are initialized (in ascending order)
    public int Priority => 0; 

		// Use async/await if you need to initialize things asynchronously
    public Task Initialize()
    {
        // Custom module initialization
        return Task.CompletedTask;
    }
    
}

Put your initialization code in the Initialize Method.

The Priority int is used to determine what ILionModule class is initialized first. This will only matter if you have more than 1 class that is using the ILionModule interface. By default it should be 0. You can decide priority based on how quickly during loading you want your custom module to be loaded.

The setup is now complete. Please get in touch with Lion SDK Support for any issues or questions.

Resulting Console Output