Scenes Loader
Presented by ScenesLoader class, this system assists you in work with game scenes.
To use this system, inject ScenesLoader class into your class, as shown below:
[Inject] private ScenesLoader scenesLoader;
Parameters in inspector
mainMenuSceneName – main menu scene name. Scenes Loader will load this scene in case if you call ToMainMenu() method. Default value: "MainMenuScene".
loadingLabel – TextMeshProUGUI text label on loading screen, where loading progress will be displayed.
loadingBar – Image of loading bar, which indicates scene loading progress.
minLoadingTime – minimal loading time in seconds; time delay between scenes will not be lesser than this amount. Default value: 2 seconds.
Available methods
void ToMainMenu()
This method returns user to main menu scene. Scene loading process is asynchronous.
void LoadSceneAsync(string name)
This method asynchronously loads scene with name.
Example:
scenesLoader.LoadSceneAsync("Level00");
void LoadSceneAsync(string name, Action callback)
This method asynchronously loads scene with name and invokes callback action afterwards.
Example:
scenesLoader.LoadSceneAsync(levelName, () => { uiController.ShowUIParts(UIPartType.InGameHUD); });
bool IsSceneLoading()
This method returns true if some scene is loading at the moment.
Last updated