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 authority property in NetworkBehaviour while in host mode #3634

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 7 additions & 3 deletions Assets/Mirror/Core/NetworkBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ public abstract class NetworkBehaviour : MonoBehaviour
//
// also note that this is a per-NetworkBehaviour flag.
// another component may not be client authoritative, etc.
//
// checking isServer firstly in case we are in host mode
// otherwise checking isClient && isOwned
// otherwise no authority
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3529
public bool authority =>
isClient
? syncDirection == SyncDirection.ClientToServer && isOwned
: syncDirection == SyncDirection.ServerToClient;
isServer && syncDirection == SyncDirection.ServerToClient ||
isClient && syncDirection == SyncDirection.ClientToServer && isOwned;

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