Table of Contents

Class CoherenceSceneManager

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll
public class CoherenceSceneManager
Inheritance
CoherenceSceneManager

Constructors

CoherenceSceneManager(CoherenceClientConnectionManager)

public CoherenceSceneManager(CoherenceClientConnectionManager clientConnections)

Parameters

clientConnections CoherenceClientConnectionManager

Methods

LoadScene(CoherenceBridge, int, IEnumerable<CoherenceSync>, IEnumerable<CoherenceSync>)

Helper method for loading a new Unity scene in a way that also works with coherence scenes. Before making the scene switch, it will make sure authorization is correct for entities that should be moved to the new scene and for entities that should be left behind in the old one. It will also make the necessary calls to set the scene on your CoherenceClientConnection, and the instantiation scene on the CoherenceBridge.

public static IEnumerator LoadScene(CoherenceBridge bridge, int sceneBuildIndex, IEnumerable<CoherenceSync> bringAlong = null, IEnumerable<CoherenceSync> leaveBehind = null)

Parameters

bridge CoherenceBridge
sceneBuildIndex int
bringAlong IEnumerable<CoherenceSync>

Entities that should be transferred to the next scene. These must be root objects in the scene since they are temporarily marked as DontDestroyOnLoad. It is necessary that authority can be transferred or stolen for the entities that should be brought along, or otherwise this co-routine will yield indefinitely (waiting for authority).

leaveBehind IEnumerable<CoherenceSync>

Entities that should be left in the scene. This method will abandon those entities (which might take a few frames) and then perform the scene load.

Returns

IEnumerator

LoadScene(CoherenceBridge, string, IEnumerable<CoherenceSync>, IEnumerable<CoherenceSync>)

public static IEnumerator LoadScene(CoherenceBridge bridge, string scenePath, IEnumerable<CoherenceSync> bringAlong = null, IEnumerable<CoherenceSync> leaveBehind = null)

Parameters

bridge CoherenceBridge
scenePath string
bringAlong IEnumerable<CoherenceSync>
leaveBehind IEnumerable<CoherenceSync>

Returns

IEnumerator

LoadSceneAdditive(CoherenceBridge, int, bool)

Helper method for loading scenes additively. The currently open scene will remain open. Any networked entities in the additively loaded scene will use the current bridge for networking.

public static IEnumerator LoadSceneAdditive(CoherenceBridge bridge, int sceneBuildIndex, bool mergeScenes = false)

Parameters

bridge CoherenceBridge
sceneBuildIndex int
mergeScenes bool

Optionally, the additively loaded scene can be merged into the currently open scene.

Returns

IEnumerator

LoadSceneAdditive(CoherenceBridge, string, bool)

Helper method for loading scenes additively. The currently open scene will remain open. Any networked entities in the additively loaded scene will use the current bridge for networking.

public static IEnumerator LoadSceneAdditive(CoherenceBridge bridge, string scenePath, bool mergeScenes = true)

Parameters

bridge CoherenceBridge
scenePath string
mergeScenes bool

Optionally, the additively loaded scene can be merged into the currently open scene.

Returns

IEnumerator

SetClientScene(int)

public void SetClientScene(int newSceneIndex)

Parameters

newSceneIndex int

SetClientScene(uint)

public void SetClientScene(uint newSceneIndex)

Parameters

newSceneIndex uint