clientAuthorityOwner is null on a playerobject?

Hello!

I’m currently implementing “Ownable” entities.
Now I’d really like to utilize AssignClientAuthority/RemoveClientAuthority for this.
These work with a clients NetworkConnection. I plug the localplayers clientAuthorityOwner into this.

So I am trying to call AssignClientAuthority(LocalPlayer.networkIdentity.clientAuthorityOwner) on an Ownable. This works well on the Host.

However it fails on the other clients because the clientAuthorityOwner is null on their respective Playerobject.

The Documentation reads “clientAuthorityOwner: The client that has authority for this object. This will be null if no client has authority.”

What am I missing? Or is this a bug?

Edit: Is calling AssignClientAuthority required to be within a [Command]?

Ok I guess I got it. I figured I need to assign the authorities on the server via Command, because it throws an complaining error if called from a remote client. Therefore I can just use the requesting entitys property connectionToClient instead (its always set on the server). To notify all clients, I then call a rpc function that invokes an event (user changed).(Edit: Meanwhile I read about SyncVar hooks. Thats of course better than manually invoking an event)