diff --git a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs index ccbe7756bf..830b1004ab 100644 --- a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs @@ -544,13 +544,16 @@ internal void ProcessPendingApprovals() try { HandleConnectionApproval(senderId, response); - - senders ??= new List(); - senders.Add(senderId); } catch (Exception e) { Debug.LogException(e); + OnClientDisconnectFromServer(senderId); + } + finally + { + senders ??= new List(); + senders.Add(senderId); } } } diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs index 81542e3318..8d0669bcfc 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs @@ -59,8 +59,20 @@ internal void GenerateGlobalObjectIdHash() return; } - var globalObjectIdString = UnityEditor.GlobalObjectId.GetGlobalObjectIdSlow(this).ToString(); + var globalObjectId = UnityEditor.GlobalObjectId.GetGlobalObjectIdSlow(this); + if (globalObjectId.assetGUID.Empty() && globalObjectId.identifierType == 0 && + globalObjectId.targetObjectId == 0 && globalObjectId.targetPrefabId == 0) + { + return; + } + + var lastIdHash = GlobalObjectIdHash; + var globalObjectIdString = globalObjectId.ToString(); GlobalObjectIdHash = XXHash.Hash32(globalObjectIdString); + if (lastIdHash != GlobalObjectIdHash) + { + UnityEditor.EditorUtility.SetDirty(this.gameObject); + } } #endif // UNITY_EDITOR