UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Ui Module / Scene System Completed

Ui Module — UGTK

Scene System

Summary

The Scene System provides a simple and practical way to load scenes directly from UI events or scripts.
It supports loading scenes by name, reloading the current scene, and loading a scene assigned directly in the Inspector through a serialized scene reference.

This system is designed to work seamlessly in both the Unity Editor and runtime builds.


Content


Modules Dependencies

The Scene System module requires the following dependencies:


Setup

To set up the Scene System, follow these steps:

Scene System Setup

  1. Add the Mn_OpenScene component to a GameObject:

  1. Assign a scene directly in the Inspector using the Serialized Scene Asset field:

  1. Connect one of the available public methods to a UI Button or custom UnityEvent:

  2. OpenScene(string sceneName)

  3. OpenCurrentScene()
  4. OpenSerializedScene()


How To Use

Public methods that are available to use:

mn_OpenScene.OpenScene("MainMenu");
mn_OpenScene.OpenCurrentScene();
mn_OpenScene.OpenSerializedScene();

Notes

The assigned scene must be included in Build Settings in order to be loaded in runtime builds. Ensure that the required scenes are included in: - File > Build Profiles > Scenes List


Testing Scene

Open SceneSystem in the module's Debug/ folder and select Canvas > OpenSceneButton. The Build Settings check in its inspector works with the editor stopped; the three Open buttons below it need Play mode.

What to do, in order:

  1. Read the Build Settings check. If the scene is missing it says so in red, and Add to the Build Settings puts it there: the message turns into "in the Build Settings and enabled" without leaving the inspector.
  2. Wire a button to OpenSerializedScene() and press it in Play Mode.
  3. Remove the target scene from the Build Settings and press it again.
  4. Press OpenCurrentScene() to reload where you are.

Step 3 is the failure this system produces most often, and it is silent from the player's side: the scene is not in the build list, Unity logs an error, and the button simply does nothing. The inspector checks the build list at edit time and offers to add the scene.


Technical Info

The following are the main scripts and workflow of the Scene System. Refer to the UML section for the detailed structure.

Scripts:


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 0

  • Standalone: no other module required.

Used by 2

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