From 741c2fb7accc95aef27656b893e6b4e7de6968db Mon Sep 17 00:00:00 2001 From: Mathieu Nachury Date: Mon, 1 Jun 2026 17:34:09 +0000 Subject: [PATCH] fix: end TransportConnect profiler marker on early returns in ConnectEventHandler BeginSample was called at the top of ConnectEventHandler but two early return paths (duplicate server transport ID and duplicate client connect event) exited without calling EndSample, causing the 'Missing Profiler.EndSample' error surfaced by the MultipleConnectMessagesNoop playmode tests. --- .../Runtime/Connection/NetworkConnectionManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs index 1da9ddb3bb..abd63a8254 100644 --- a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs @@ -522,6 +522,9 @@ internal void ConnectEventHandler(ulong transportId) { NetworkLog.LogError($"[TransportApproval][Server] TransportId {transportId} is already connected to this server!"); } +#if DEVELOPMENT_BUILD || UNITY_EDITOR + s_TransportConnect.End(); +#endif return; } @@ -536,6 +539,9 @@ internal void ConnectEventHandler(ulong transportId) { NetworkLog.LogError("[TransportApproval][Client] Client received a transport connection event after already connecting!"); } +#if DEVELOPMENT_BUILD || UNITY_EDITOR + s_TransportConnect.End(); +#endif return; }