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

Conversation

vakuor
Copy link

@vakuor vakuor commented Oct 29, 2023

Fixes #3528.
Fixes #3529.
Closes #3530.

This fix changes behaviour of NetworkBehaviour.authority property to return true while you are host and has authority over object.

If server and syncDirection is ServerToClient - return true, otherwise false.
If client and syncDirection is ClientToServer and object is owned - return true, otherwise false.

This condition is more readable than the old one and is still fast.

Still there an possible usage error while on the server you are trying to use OnStartAuthority or OnStopAuthority since you have an authority. To fix this we need to allow usage of OnStartAuthority and OnStartAuthority on server. Maybe it is related to #3495.

@vakuor vakuor marked this pull request as draft October 29, 2023 14:21
@vakuor vakuor marked this pull request as ready for review October 29, 2023 14:22
@miwarnec
Copy link
Collaborator

fixed, thanks

@miwarnec miwarnec closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC SyncDirection .authority is false hasAuthority is false for NPCs
2 participants