Table of Contents

LoadScene

Methods
public static IEnumerator LoadScene(CoherenceBridge bridge, string scenePath, IEnumerable<CoherenceSync> bringAlong = null, IEnumerable<CoherenceSync> leaveBehind = null, LoadSceneMode loadSceneMode = 0)
Parameters
Type Name Description
CoherenceBridge bridge
string scenePath
IEnumerable<CoherenceSync> bringAlong
IEnumerable<CoherenceSync> leaveBehind
LoadSceneMode loadSceneMode
Returns
Type Description
IEnumerator
public static IEnumerator LoadScene(CoherenceBridge bridge, int sceneBuildIndex, IEnumerable<CoherenceSync> bringAlong = null, IEnumerable<CoherenceSync> leaveBehind = null, LoadSceneMode loadSceneMode = 0)

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.

Parameters
Type Name Description
CoherenceBridge bridge
int sceneBuildIndex
IEnumerable<CoherenceSync> bringAlong

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).

IEnumerable<CoherenceSync> leaveBehind

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.

LoadSceneMode loadSceneMode

Load scene mode for a scene to be loaded with. Default value isLoadSceneMode.Single.

Returns
Type Description
IEnumerator