UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Gameplay Systems / Loading System Completed

Gameplay Systems — UGTK

Loading System

Summary

The Loading System is a singleton loading-screen manager that instantiates a loading prefab under a chosen (or auto-found) Canvas and shows an animated "Loading..." text with a progress slider and percentage. It supports timed loadings, indefinite/visual-only loadings, and multi-step weighted processes.


Content


Modules Dependencies


Setup

  1. Put the LoadingManager prefab in every scene that shows a loading screen, or call DontDestroyOnLoad on it yourself. Mn_LoadingManager is a Mn_Singleton: there must be exactly one at a time, and it does not survive a scene load on its own.
  2. Use LoadingPrefab for the visible part - the screen, the bar, the label - or replace it with your own and keep the same references.
  3. Describe the work as LoadingProcess entries rather than loading in one call. Each one reports its own progress, and the bar is their sum.

The reason for the third step is worth stating plainly: SceneManager.LoadSceneAsync reports progress for the scene only, so a bar driven straight from it reaches 90% and freezes there while everything else - databases, textures, a server round trip - happens with no feedback at all. Splitting the work into processes is what makes the last tenth of the bar mean something.


How To Use

  1. Add Mn_LoadingManager to a bootstrap GameObject and assign loadingObjectPrefab (must contain a TMP_Text, a Slider and a child TMP_Text named "Advanced").
  2. Leave autoFindCanvas on to auto-pick a Canvas named "Main" (or the first active one), or disable it and assign canvasRef manually.
  3. Access it via Mn_LoadingManager.Instance:
  4. StartLoading() / StartLoading(startAction, endAction) runs a timed loading of defaultDuration; a negative duration means infinite (text only, no slider).
  5. EndLoading() hides the loading UI.
  6. SetProcesses(List<LoadingProcess>, onComplete) then UpdateProcessProgress(current, max) drives a weighted multi-step progress bar (each LoadingProcess has start, end, name).
  7. Enable autoStart to begin loading automatically on Start.

Testing Scene

Open LoadingScene in the module's Debug/ folder.

What to do, in order:

  1. Call SetProcesses() with two or three steps, then StartLoading().
  2. Drive each one with UpdateProcessProgress() and watch the bar.
  3. Call EndLoading() before the last process has finished.

Step 3 is the case that matters in a real game: loading almost never ends exactly when the bar reaches the end, and a bar that jumps from 60% to gone looks like a crash rather than a finish.

LoadingScene with Test Loading Processes pressed from the manager's inspector. The loading prefab is inactive until a process starts, which is why the scene looks empty at rest; the bar then advances through the queued processes rather than through one scene load.


Technical Info


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 1

Used by 4

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 1 module in total.