mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix(NetworkManager): Prevent client from calling ServerChangeScene (#3729)
- Throws error if server isn't active - allows for changing to offline scene regardless
This commit is contained in:
parent
6445547aef
commit
6e0c4a66d8
@ -850,6 +850,14 @@ public virtual void ServerChangeScene(string newSceneName)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Throw error if called from client
|
||||||
|
// Allow changing scene while stopping the server
|
||||||
|
if (!NetworkServer.active && newSceneName != offlineScene)
|
||||||
|
{
|
||||||
|
Debug.LogError("ServerChangeScene can only be called on an active server.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Debug.Log($"ServerChangeScene {newSceneName}");
|
// Debug.Log($"ServerChangeScene {newSceneName}");
|
||||||
NetworkServer.SetAllClientsNotReady();
|
NetworkServer.SetAllClientsNotReady();
|
||||||
networkSceneName = newSceneName;
|
networkSceneName = newSceneName;
|
||||||
|
Loading…
Reference in New Issue
Block a user