Skip to content

Commit 762033a

Browse files
author
mischa
committed
fix: #3529 NPC SyncDirection 'authority' now evaluates to true on the server/host
1 parent 0e8d1c9 commit 762033a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Assets/Mirror/Core/NetworkBehaviour.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public abstract class NetworkBehaviour : MonoBehaviour
8585
// also note that this is a per-NetworkBehaviour flag.
8686
// another component may not be client authoritative, etc.
8787
public bool authority =>
88-
isClient
89-
? syncDirection == SyncDirection.ClientToServer && isOwned
90-
: syncDirection == SyncDirection.ServerToClient;
88+
// check isServer instead of isClient, which covers host mode too.
89+
// otherwise host mode would only have authority if ClientToServer.
90+
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3529
91+
isServer
92+
? syncDirection == SyncDirection.ServerToClient
93+
: syncDirection == SyncDirection.ClientToServer && isOwned;
9194

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

0 commit comments

Comments
 (0)