I have a simple command, all that it should do is change the authority of the object that is passed to it. For some reason, even when run through command, AssignAuthority returns the error `AssignClientAuthority can only be call on the server for spawned objects.
UnityEngine.Networking.NetworkIdentity:AssignClientAuthority(NetworkConnection)
Player:CmdAssignAuthority(GameObject) (at Assets/Player/Game/Scripts/Player.cs:71)`
Below is the code for the method:
[Command]
public void CmdAssignAuthority(GameObject obj)
{
obj.GetComponent().AssignClientAuthority(GetComponent().connectionToClient);
}
↧