From bb552f8a54da380ef0ecbeccb582773a0a0a336e Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:21:41 -0400 Subject: [PATCH] fix(NetworkManager): offlineSceneLoadDelaySeconds -> offlineSceneLoadDelay and Range 0-60 --- Assets/Mirror/Core/NetworkManager.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Assets/Mirror/Core/NetworkManager.cs b/Assets/Mirror/Core/NetworkManager.cs index 1513b9938..301587904 100644 --- a/Assets/Mirror/Core/NetworkManager.cs +++ b/Assets/Mirror/Core/NetworkManager.cs @@ -76,8 +76,8 @@ public class NetworkManager : MonoBehaviour [Tooltip("Scene that Mirror will switch to when the server is started. Clients will recieve a Scene Message to load the server's current scene when they connect.")] public string onlineScene = ""; - [Tooltip("Optional delay that can be used after disconnecting to show a 'Connection lost...' message or similar before loading the offline scene, which may take a long time in big projects.")] - public float offlineSceneLoadDelaySeconds = 0; + [Range(0, 60), Tooltip("Optional delay that can be used after disconnecting to show a 'Connection lost...' message or similar before loading the offline scene, which may take a long time in big projects.")] + public float offlineSceneLoadDelay = 0; // transport layer [Header("Network Info")] @@ -1335,9 +1335,7 @@ void OnClientDisconnectInternal() // Check loadingSceneAsync to ensure we don't double-invoke the scene change. // Check if NetworkServer.active because we can get here via Disconnect before server has started to change scenes. if (!string.IsNullOrWhiteSpace(offlineScene) && !Utils.IsSceneActive(offlineScene) && loadingSceneAsync == null && !NetworkServer.active) - { - Invoke(nameof(ClientChangeOfflineScene), offlineSceneLoadDelaySeconds); - } + Invoke(nameof(ClientChangeOfflineScene), offlineSceneLoadDelay); networkSceneName = ""; } @@ -1361,9 +1359,7 @@ void OnClientSceneInternal(SceneMessage msg) // This needs to run for host client too. NetworkServer.active is checked there if (NetworkClient.isConnected) - { ClientChangeScene(msg.sceneName, msg.sceneOperation, msg.customHandling); - } } /// Called on the server when a new client connects.