UGTK / Toolkit / Ui Module / Scene System Completed
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:
- Unity SceneManagement
- Unity UI (optional, if used with Buttons or UI Events)
Setup
To set up the Scene System, follow these steps:
Scene System Setup
- Add the
Mn_OpenScenecomponent to a GameObject:
- Assign a scene directly in the Inspector using the
Serialized Scene Assetfield:
-
Connect one of the available public methods to a UI Button or custom UnityEvent:
-
OpenScene(string sceneName) OpenCurrentScene()OpenSerializedScene()
How To Use
Public methods that are available to use:
- OpenScene(string sceneName): Loads a scene by its name.
mn_OpenScene.OpenScene("MainMenu");
- OpenCurrentScene(): Reloads the currently active scene.
mn_OpenScene.OpenCurrentScene();
- OpenSerializedScene(): Loads the scene assigned in the Inspector through the serialized scene reference.
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:
- 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.
- Wire a button to OpenSerializedScene() and press it in Play Mode.
- Remove the target scene from the Build Settings and press it again.
- 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:
- Mn_OpenScene: Script used to load scenes by name, reload the current scene, or load a serialized scene assigned from the Inspector.
© 2026 Marcello De Bonis. All rights reserved
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.
UGTKengine within an engine


