From 3436df7ca4aef5fc720deeb12dfdf7be012b2388 Mon Sep 17 00:00:00 2001 From: MrGadget <9826063+MrGadget1024@users.noreply.github.com> Date: Fri, 12 Jan 2024 12:24:45 -0500 Subject: [PATCH] Can't use TryPeek in older Unity --- Assets/Mirror/Core/NetworkIdentity.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Core/NetworkIdentity.cs b/Assets/Mirror/Core/NetworkIdentity.cs index 7e7082c43..bad5968e7 100644 --- a/Assets/Mirror/Core/NetworkIdentity.cs +++ b/Assets/Mirror/Core/NetworkIdentity.cs @@ -291,11 +291,10 @@ internal struct NetworkIdPool internal static uint GetNextNetworkId() { - if (poolNetworkIds && netIdPool.TryPeek(out NetworkIdPool entry) && entry.timeAvailable < NetworkTime.time) + if (poolNetworkIds && netIdPool.Count > 0 && netIdPool.Peek().timeAvailable < NetworkTime.time) { + NetworkIdPool entry = netIdPool.Dequeue(); //Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"[GetNextNetworkId] Reusing NetworkId {entry.poolNetId}."); - - netIdPool.Dequeue(); return entry.poolNetId; }