Class CoherenceSceneManager
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
CoherenceBridgesceneBuildIndex
intbringAlong
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
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
CoherenceBridgescenePath
stringbringAlong
IEnumerable<CoherenceSync>leaveBehind
IEnumerable<CoherenceSync>
Returns
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
CoherenceBridgesceneBuildIndex
intmergeScenes
boolOptionally, the additively loaded scene can be merged into the currently open scene.
Returns
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
CoherenceBridgescenePath
stringmergeScenes
boolOptionally, the additively loaded scene can be merged into the currently open scene.
Returns
SetClientScene(int)
public void SetClientScene(int newSceneIndex)
Parameters
newSceneIndex
int
SetClientScene(uint)
public void SetClientScene(uint newSceneIndex)
Parameters
newSceneIndex
uint