I'm wondering if maybe I'm misunderstanding how Command works
{
if (!isOwned) { return; }
if (Input.GetMouseButtonDown(1))
{
Debug.Log("A");
CmdRightClick();
}
}
[Command]
private void CmdRightClick()
{
Debug.Log("B");
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit, 1024, clickMask))
{
MoveClick(hit);
}
}
[Client]
private void MoveClick(RaycastHit hit)
{
agent.SetDestination(hit.point);
Debug.Log("C");
}
So I'm doing a basic right click to move mechanic here, but for some reason this only works on the host but not the non-host clients.
On Host the debug prints out A,B and C and on non host it's only A
There is no error or warnings on either
Am I approaching this wrong? My understanding is that Command is used from client to request the server to run the function