The multi scene manager is the main class to handle scene management with this asset. You should use this instead of the normal SceneManager
when it comes to loading scenes & checking if scenes are active.
Properties
ActiveSceneGroup
SceneGroup
โ Get
Gets the currently active scene group. This will update to whichever group is the latest loaded at runtime.
var group = MultiSceneManager.ActiveSceneGroup;
Events
BeforeScenesLoaded
void
โ Event
An event that raises just before the system loads a scene group.
MultiSceneManager.BeforeScenesLoaded.Add(MyMethod);
private void MyMethod()
{
.....
PostScenesLoaded
void
โ Event
An event that raises after the system had loaded a scene group & all interfaces have been called.
MultiSceneManager.PostScenesLoaded.Add(MyMethod);
private void MyMethod()
{
.....
OnSceneLoaded
โ string
Event
An event that raises after the system has loaded any scene, it passes through the name of the scene loaded as a param.
MultiSceneManager.OnSceneLoaded.Add(MyMethod);
private void MyMethod(string sceneName)
{
.....
OnSceneUnloaded
string
โ Event
An event that raises after the system has unloaded any scene, it passes through the name of the scene unloaded as a param.
MultiSceneManager.OnSceneUnloaded.Add(MyMethod);
private void MyMethod(string sceneName)
{
.....
OnSceneGroupLoaded
void
โ Event
An event that raises after the system has loaded a scene group, this event doesnโt pass through the scene group as a param. Use OnSceneGroupLoadedWithCtx for a passthrough.
MultiSceneManager.OnSceneGroupLoaded.Add(MyMethod);
private void MyMethod()
{
.....
OnSceneGroupLoadedWithCtx
SceneGroup
โ Event
An event that raises after the system has loaded a scene group, it passes the group loaded as a param.
MultiSceneManager.OnSceneGroupLoadedWithCtx.Add(MyMethod);
private void MyMethod(SceneGroup group)
{
.....
Methods
IsSceneInGroup
Method
string โ The scene name to search for.
Returns
bool โ Whether or not the scene is in the group.
A helper method to get whether or not a scene is in the currently loaded scene group.
private void MyMethod()
{
if (MultiSceneManager.IsSceneInGroup("MyScene")
{
// Logic here...
}
}
Method
SceneGroup โ The scene group to search through.
Returns
bool โ Whether or not the scene is in the group.
A helper method to get whether or not a scene is in the group entered.
SceneGroup group;
private void MyMethod()
{
if (MultiSceneManager.IsSceneInGroup(group, "MyScene")
{
// Logic here...
}
}
IsSceneLoaded
Method
string โ The scene name to
Returns
bool โ Whether or not the scene is in the group.
A helper method to get whether or not a scene is in the currently loaded.
private void MyMethod()
{
if (MultiSceneManager.IsSceneLoaded("MyScene")
{
// Logic here...
}
}
SetGroup
Method
SceneGroup
โ The scene group to load.
A helper method to sets the active group to the group entered.
private void MyMethod()
{
if (MultiSceneManager.IsSceneLoaded("MyScene")
{
// Logic here...
}
}
LoadScenes
Method
bool โ Optional โ Should the system reload scenes that are already loaded? Default: true
Loads the scene group currently set in the manager.
private void MyMethod()
{
MultiSceneManager.LoadScenes();
}
Method
SceneGroup
โ The scene group to load.bool
โ Optional
โ Should the system reload scenes that are already loaded? Default: true
Loads the scene group entered and sets it as the new active scene group.
SceneGroup group;
private void MyMethod()
{
MultiSceneManager.LoadScenes(group);
}
ReloadScenes
Methodvoid
Reloads the current active scene group.
SceneGroup group;
private void MyMethod()
{
MultiSceneManager.ReloadScenes();
}
UnloadAllActiveScenes
Methodvoid
Unloads all the scenes currently loaded & loads a blank placeholder scene.
private void MyMethod()
{
MultiSceneManager.UnloadAllActiveScenes();
}
UnloadAllAdditiveScenes
Method
void
Unloads all the additive
scenes currently loaded, but leaves the active (base
) scene still running.
private void MyMethod()
{
MultiSceneManager.UnloadAllAdditiveScenes();
}