mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
Added virtual OnServerChangeScene just like OnClientChangeScene so devs can override to do prep before the change. (#1020)
This commit is contained in:
parent
236afa3c7e
commit
5c1440b2f0
@ -550,7 +550,6 @@ public void StopClient()
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(offlineScene))
|
if (!string.IsNullOrEmpty(offlineScene))
|
||||||
{
|
{
|
||||||
// Must pass true or offlineScene will not be loaded
|
|
||||||
ClientChangeScene(offlineScene, LoadSceneMode.Single, LocalPhysicsMode.None);
|
ClientChangeScene(offlineScene, LoadSceneMode.Single, LocalPhysicsMode.None);
|
||||||
}
|
}
|
||||||
CleanupNetworkIdentities();
|
CleanupNetworkIdentities();
|
||||||
@ -585,6 +584,9 @@ public virtual void ServerChangeScene(string newSceneName, LoadSceneMode sceneMo
|
|||||||
NetworkServer.SetAllClientsNotReady();
|
NetworkServer.SetAllClientsNotReady();
|
||||||
networkSceneName = newSceneName;
|
networkSceneName = newSceneName;
|
||||||
|
|
||||||
|
// Let server prepare for scene change
|
||||||
|
OnServerChangeScene(newSceneName);
|
||||||
|
|
||||||
LoadSceneParameters loadSceneParameters = new LoadSceneParameters(sceneMode, physicsMode);
|
LoadSceneParameters loadSceneParameters = new LoadSceneParameters(sceneMode, physicsMode);
|
||||||
|
|
||||||
loadingSceneAsync = SceneManager.LoadSceneAsync(newSceneName, loadSceneParameters);
|
loadingSceneAsync = SceneManager.LoadSceneAsync(newSceneName, loadSceneParameters);
|
||||||
@ -959,6 +961,13 @@ public virtual void OnServerRemovePlayer(NetworkConnection conn, NetworkIdentity
|
|||||||
/// <param name="errorCode">Error code.</param>
|
/// <param name="errorCode">Error code.</param>
|
||||||
public virtual void OnServerError(NetworkConnection conn, int errorCode) { }
|
public virtual void OnServerError(NetworkConnection conn, int errorCode) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called from ServerChangeScene immediately before SceneManager.LoadSceneAsync is executed
|
||||||
|
/// <para>This allows server to do work / cleanup / prep before the scene changes.</para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newSceneName">Name of the scene that's about to be loaded</param>
|
||||||
|
public virtual void OnServerChangeScene(string newSceneName) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1015,7 +1024,7 @@ public virtual void OnClientNotReady(NetworkConnection conn) { }
|
|||||||
/// Called from ClientChangeScene immediately before SceneManager.LoadSceneAsync is executed
|
/// Called from ClientChangeScene immediately before SceneManager.LoadSceneAsync is executed
|
||||||
/// <para>This allows client to do work / cleanup / prep before the scene changes.</para>
|
/// <para>This allows client to do work / cleanup / prep before the scene changes.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="newSceneName">Name if the scene that's about to be loaded</param>
|
/// <param name="newSceneName">Name of the scene that's about to be loaded</param>
|
||||||
public virtual void OnClientChangeScene(string newSceneName) { }
|
public virtual void OnClientChangeScene(string newSceneName) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user