Class CoherenceSceneManager
public class CoherenceSceneManager
- Inheritance
-
CoherenceSceneManager
Constructors
CoherenceSceneManager(CoherenceClientConnectionManager, IClient)
public CoherenceSceneManager(CoherenceClientConnectionManager clientConnections, IClient client)
Parameters
clientConnectionsCoherenceClientConnectionManagerclientIClient
Methods
GetClientScene()
public uint GetClientScene()
Returns
LoadScene(CoherenceBridge, int, IEnumerable<CoherenceSync>, IEnumerable<CoherenceSync>, LoadSceneMode)
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, LoadSceneMode loadSceneMode = 0)
Parameters
bridgeCoherenceBridgesceneBuildIndexintbringAlongIEnumerable<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).
leaveBehindIEnumerable<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.
loadSceneModeLoadSceneModeLoad scene mode for a scene to be loaded with. Default value isLoadSceneMode.Single.
Returns
LoadScene(CoherenceBridge, string, IEnumerable<CoherenceSync>, IEnumerable<CoherenceSync>, LoadSceneMode)
public static IEnumerator LoadScene(CoherenceBridge bridge, string scenePath, IEnumerable<CoherenceSync> bringAlong = null, IEnumerable<CoherenceSync> leaveBehind = null, LoadSceneMode loadSceneMode = 0)
Parameters
bridgeCoherenceBridgescenePathstringbringAlongIEnumerable<CoherenceSync>leaveBehindIEnumerable<CoherenceSync>loadSceneModeLoadSceneMode
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
bridgeCoherenceBridgesceneBuildIndexintmergeScenesboolOptionally, 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
bridgeCoherenceBridgescenePathstringmergeScenesboolOptionally, the additively loaded scene can be merged into the currently open scene.
Returns
SetClientScene(int)
public void SetClientScene(int newSceneIndex)
Parameters
newSceneIndexint
SetClientScene(uint)
public void SetClientScene(uint newSceneIndex)
Parameters
newSceneIndexuint