Skip to content

Commit

Permalink
fix: #3529 NPC SyncDirection 'authority' now evaluates to true on the…
Browse files Browse the repository at this point in the history
… server/host
  • Loading branch information
mischa committed Jun 27, 2023
1 parent 020c514 commit 9bfcd1c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Assets/Mirror/Core/NetworkBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ public abstract class NetworkBehaviour : MonoBehaviour
// also note that this is a per-NetworkBehaviour flag.
// another component may not be client authoritative, etc.
public bool authority =>
isClient
? syncDirection == SyncDirection.ClientToServer && isOwned
: syncDirection == SyncDirection.ServerToClient;
// check isServer instead of isClient, which covers host mode too.
// otherwise host mode would only have authority if ClientToServer.
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3529
isServer
? syncDirection == SyncDirection.ServerToClient
: syncDirection == SyncDirection.ClientToServer && isOwned;

/// <summary>The unique network Id of this object (unique at runtime).</summary>
public uint netId => netIdentity.netId;
Expand Down

0 comments on commit 9bfcd1c

Please sign in to comment.