- Home /
Client can't send Commands despite localPlayerAuthority is true
I have tried both automatically spawning the player and manually with ClientScene.AddPlayer and NetworkServer.AddPlayerForConnection. It seems the player is spawned clientside with localPlayerAuthority however it cannot send Cmd. I don't get any errors, nothing happens as if it doesn't have authority.
Okay so the commands are being sent but not run on the client itself? is the client meant to send a command then the server runs the same command back as an rpc? That sounds wrong...
Why would a command be invoked on a client? The docs state that it is invoked on a server from a client. If you really want, you can just have your code in a separate function and call it on both the client and server like this example, which will execute DoAction() on the client with authority, and the server:
void Start()
{
CmdDoCommand();
DoAction();
}
[Command]
public void CmdDoCommand()
{
DoAction();
}
void DoAction()
{
}
What exactly are you doing that you want to have happen on only the local client and server, but not on other clients?
Your answer
