From 387be93703dec141752b6ea92d3cc80db06b4ede Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Sat, 13 Jan 2024 16:22:07 -0500 Subject: [PATCH] Renamed poolNetworkIds to reuseNetworkIds - Also changed header and range upper limit --- Assets/Mirror/Core/NetworkIdentity.cs | 10 +++++----- Assets/Mirror/Core/NetworkManager.cs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs index bad5968e7..622bc121e 100644 --- a/Assets/Mirror/Core/NetworkIdentity.cs +++ b/Assets/Mirror/Core/NetworkIdentity.cs @@ -264,7 +264,7 @@ internal static void ResetClientStatics() internal static void ResetServerStatics() { - poolNetworkIds = true; + reuseNetworkIds = true; reuseDelay = 1; netIdPool.Clear(); @@ -276,7 +276,7 @@ internal static void ResetServerStatics() #region NetworkID Handling - internal static bool poolNetworkIds = true; + internal static bool reuseNetworkIds = true; internal static byte reuseDelay = 1; internal struct NetworkIdPool @@ -291,7 +291,7 @@ internal struct NetworkIdPool internal static uint GetNextNetworkId() { - if (poolNetworkIds && netIdPool.Count > 0 && netIdPool.Peek().timeAvailable < NetworkTime.time) + if (reuseNetworkIds && netIdPool.Count > 0 && netIdPool.Peek().timeAvailable < NetworkTime.time) { NetworkIdPool entry = netIdPool.Dequeue(); //Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"[GetNextNetworkId] Reusing NetworkId {entry.poolNetId}."); @@ -662,7 +662,7 @@ void OnDestroy() NetworkServer.Destroy(gameObject); } - if (isServer && poolNetworkIds && netId > 0) + if (isServer && reuseNetworkIds && netId > 0) netIdPool.Enqueue(new NetworkIdPool { poolNetId = netId, timeAvailable = NetworkTime.time + reuseDelay }); if (isLocalPlayer) @@ -1337,7 +1337,7 @@ internal void Reset() if (netId > 0) { - if (poolNetworkIds) + if (reuseNetworkIds) netIdPool.Enqueue(new NetworkIdPool { poolNetId = netId, timeAvailable = NetworkTime.time + reuseDelay }); netId = 0; diff --git a/Assets/Mirror/Core/NetworkManager.cs b/Assets/Mirror/Core/NetworkManager.cs index 5648a4d92..41c52c47f 100644 --- a/Assets/Mirror/Core/NetworkManager.cs +++ b/Assets/Mirror/Core/NetworkManager.cs @@ -63,10 +63,10 @@ public class NetworkManager : MonoBehaviour // [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")] // public int clientSendRate = 30; // 33 ms - [Header("Network ID Pooling")] + [Header("Network ID Reuse")] [Tooltip("Reuse network IDs when objects are unspawned or destroyed?")] - public bool poolNetworkIds = true; - [Range(1, 30)] + public bool reuseNetworkIds = true; + [Range(1, 60)] [Tooltip("Delay in seconds before network IDs are reused")] public byte reuseDelay = 1; @@ -329,7 +329,7 @@ void SetupServer() NetworkServer.exceptionsDisconnect = exceptionsDisconnect; // Setup reuseable network IDs - NetworkIdentity.poolNetworkIds = poolNetworkIds; + NetworkIdentity.reuseNetworkIds = reuseNetworkIds; NetworkIdentity.reuseDelay = reuseDelay; if (runInBackground)