I’m trying to call a command function on a parent from a child and it doesn’t seem to run. Can someone please give some insight?
This is called from the player
void Update ()
{
if (!isLocalPlayer)
{
return;
}
if (Input.GetKey(KeyCode.Mouse0))
{
if (weapon)
{
weapon.Fire();
}
}
}
This is run on the weapon child
public void Fire()
{
CmdFire();
}
This is on the weapon parent
[Command]
public void CmdFire()
{
do stuff
}
The command/function is never run. How can I make this work?
I didn’t read enough.
It specifically states in the API:
For security, Commands can only be sent from YOUR player object, so you cannot control the objects of other players.