Synced Animation on Command?

Hi, I’ve been testing multiplayer but I’m stuck on syncing the animation.

I want to sync an attack animation that triggers on pressing the A key.
So all I want to do is call an animation on all clients connected as well as the server.

The issue I have is that the command calls it only on server side and not on any clients.
Do I have to do an RPC call inside the Command or something?

void UpdateInput()
{
     if (Input.GetKeyDown(KeyCode.A))
     {
            CmdDoAttack();
     }
}

[Command]
void CmdDoAttack()
{
    _anim.SetTrigger("Kick");
}

yes you could do it like:

void UpdateInput()
{
     if (Input.GetKeyDown(KeyCode.A))
     {
            CmdDoAttack();
     }
}
[Command]
void CmdDoAttack()
{
    // check if player can attack
    if (isDead)
        return;
       
    RpcAttack();
}

[ClientRpc]
void RpcAttack()
{
    _anim.SetTrigger("Kick");
}
1 Like

Thanks seanr, that worked but it wasn’t calling it on the server side - had to make a small change.

I feel like they should have a way to send to the server + all clients instead of doing this but I guess this is not too bad.

[Command]
void CmdDoAttack()
{
    if (isDead) return;
    _anim.SetTrigger("Kick");
    RpcDoAttack();
}

ClientRpc calls are supposed to be called on the host. That is bug:

That is fixed in 5.1p1. You have the right workaround for now.

IsSyncEvent supposed to not fire on a local host for networked scene objects?

it is supposed to fire on the host also.

From what I can tell, even on 5.1.0p1 ClientRpc and SyncEvent aren’t calling on a local host for networked scene objects.