SetLayerWeight on Unet

Hi,

I want to set layer weight when player fire, on the base layer all animations works fine both client and server but when I set the layer weight this does not seen on client.

I tried these so far;

  • Using [Command] and Cmd function to set layer weight.
  • Using SetParameterAutoSend for each parameter.
  • Set the layer weight both normal Animator and the Network Animator

What am I missing?

Thank you for your answers.

Finally I solved the issue, thank you for all your supports.

The solution is ClientRpc method, you have to set layer weight in ClientRpc method.

1 Like

Hello
Can you tell us how did you do that?
i tried somthing like this but didn’t work…just a example not a complete code:

private float crouchWeight;
private float jumpWeight;

void Update() {
           if (isLocal) {
            if (Input.GetButton ("LeftCtrl")) {
                Crouching();
            }
            }

if (!isLocal) {
            RpcCrouchWeight (crouchWeight , jumpWeight);
        }
}
void Crouching() {
         _animator.SetLayerWeight (1, crouchWeight);

}

[ClientRpc]
public void RpcCrouchWeight(float _crouchWeight , float _jumpWeight) {
        crouchWeight = _crouchWeight;
        jumpWeight = _jumpWeight;
    }