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:
- Initialize all SDKs
- Display the logo of the developing studio (optional)
- Display the new animated logo of LionStudios (optional)
⛔ | The Lion logo must not be displayed without explicit confirmation from your Lion representative. This feature is applicable only if the game has already been transferred from your store account to Lion’s account. |
Example
⚠️ | If you develop your own custom loading scene instead of using this one, be sure to make it wait for LionCore.OnInitialized.
You can use the LoadingSceneManager component: add it in your loading scene, it will wait for all Lion modules to be initialized, then load the next scene (at index 1). |
Setup
The Loading Scene can be automatically set up using the Setup Wizard.
💡 | Make sure to edit your code if it includes any code like SceneManager.LoadScene(0), as the loading scene gets added as scene 0. |
💡 | The newly added scene ”AnimatedLionLogoScene” is customizable. You can rearrange the elements in the scene according to your needs. |
Settings
Display Lion Logo
- Enable this only if the game is on Lion Studios official account
⚠️ | The Lion Logo must not be displayed without explicit confirmation from your Lion representative. This feature is applicable only if the game has already been transferred from your Store Account to Lion’s Account. |
Display Custom Logo
- Enable this to show your company logo on the splash screen.
Example of a custom logo
Custom Logo
- Insert your sprite image here to display your company logo. The recommended dimensions for the image are512
x512
.Custom Logo Duration
- The custom logo features a fade-in effect. This variable determines how fast or slow the image takes to fade in. By default, this is set to1.5
. (The larger the number, the slower the animation is).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.
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;
}
}
Implementation Example
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