com.rwth.unity.omilaxr.scenemanager
v0.1.2
Published
Manage scenes for builds with OmiLAXR.SceneManager. Auto-generate scene enums, set default base/start scenes, and simplify load/unload operations
Downloads
8
Readme
OmiLAXR.SceneManager
Effortlessly manage scenes for builds with OmiLAXR.SceneManager. Auto-generate scene enums, set default base/start scenes, and simplify load/unload operations.
Key Features
- Auto-generate enum containing scenes from build settings (properly displayed in the editor)
- Load/unload scenes using the generated enum
- Set a base scene that should always be loaded
- Define start scenes to load on start when only the base scene is present
- Trigger various events on scene loading and unloading
- Utilize the Scene Queue component to move through a predefined sequence of scenes (e.g., for a Guided Tour)
Installation
Install the package using the package manager and adding it with the following git url:
https://gitlab.com/learntech-rwth/omilaxr-ecosystem/omilaxr.scenemanager.git
Another possibility is to clone the repository into the Packages
folder.
Generated Enum (OmiLAXRScene)
After installing the package, locate the generated scene enum under Assets/Resources/Unity Scene Manager
. Manual
changes to the enum will be overwritten during regeneration. The enum additionally provides the ability to retrieve:
Path()
: Get the path to the corresponding sceneIndex()
: Get the build index of the corresponding sceneIsLoaded()
: Get the loaded state of the sceneName()
: Get the name of the sceneGetScene()
: Get the Unity scene object of the sceneGetRootGameObjects()
: Get the root game objects in the scene
Scene Controller Setup
Configure the start and base scenes for your project using the configuration window
under OmiLAXR > Scene Controller Configuration
.
- Set active on launch: Control which scene should be set as the active scene on launch.
- Base scene: Control which scene should always be loaded on launch. When starting playmode in the editor, the base scene will be loaded additionally to the already opened scene.
- Start scenes: Control which scenes should be loaded on top of the base scene on launch. When the base scene is already loaded in the editor, the start scenes will additionally be loaded.
To disable this behavior for a specific scene, add the NoAdditionalSceneLoad.cs
component anywhere in the scene.
The Samples
folder also provides a prefab that can be dropped into a scene.
Scene Loading
Load/unload scenes via script using the following async methods located in the OmiLAXR.SceneManagement.Runtime
namespace:
LoadScene(OmiLAXRScene scene, LoadSceneMode mode, bool setActive)
OmiLAXRScene scene
: The scene to be loaded.LoadSceneMode mode
: Should the scene be loaded in single or additive mode?bool setActive
: Should the scene be set as the active scene after loading?
UnloadScene(OmiLAXRScene scene)
OmiLAXRScene scene
: The scene to be unloaded.
Unity versions newer than 2023.1 use the Awaitable
type, while older versions use the Task
type.
License
This project is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details.