Skip to content

Commit 96020b0

Browse files
fix
All clients in distributed authority should invoke CheckForGlobalObjectIdHashOverride when spawning a NetworkPrefab since each client has the authority to spawn (i.e. each should be treated like a host/server in regards to spawning and prefab overrides).
1 parent f170341 commit 96020b0

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
@@ -3246,14 +3246,15 @@ internal void UpdateForSceneChanges()
32463246
}
32473247

32483248
/// <summary>
3249-
/// Only applies to Hosts or session owners (for now)
3249+
/// Client-Server: Only applies to spawn authority (i.e. Server)
3250+
/// Distributed Authority: Applies to all clients since they all have spawn authority.
32503251
/// Will return the registered source NetworkPrefab's GlobalObjectIdHash if one exists.
32513252
/// Server and Clients will always return the NetworkObject's GlobalObjectIdHash.
32523253
/// </summary>
32533254
/// <returns>appropriate hash value</returns>
32543255
internal uint CheckForGlobalObjectIdHashOverride()
32553256
{
3256-
if (NetworkManager.IsServer || (NetworkManager.DistributedAuthorityMode && NetworkManager.LocalClient.IsSessionOwner))
3257+
if (NetworkManager.IsServer || NetworkManager.DistributedAuthorityMode)
32573258
{
32583259
if (NetworkManager.PrefabHandler.ContainsHandler(this))
32593260
{

0 commit comments

Comments
 (0)