Skip to content

Commit 3f17e83

Browse files
committed
Address PR feedback
1 parent 73a0bf8 commit 3f17e83

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,8 @@ public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
22262226
return false;
22272227
}
22282228

2229-
if (!NetworkManager.IsListening)
2229+
var networkManager = NetworkManager;
2230+
if (!networkManager || !networkManager.IsListening)
22302231
{
22312232
return false;
22322233
}
@@ -2237,7 +2238,7 @@ public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
22372238

22382239
// If we don't have authority, and we are not shutting down, then don't allow any parenting.
22392240
// If we are shutting down and don't have authority then allow it.
2240-
if (!isAuthority && !NetworkManager.ShutdownInProgress)
2241+
if (!isAuthority && !networkManager.ShutdownInProgress)
22412242
{
22422243
return false;
22432244
}

0 commit comments

Comments
 (0)