Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #3529 NPC SyncDirection 'authority' now evaluates to true on the server/host #3531

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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