Replication when using animator methods

Options
hey guys,

when using the mecanim animator methods (e.g. animator.SetInt), will the properties set in the state also replicated automatically when updating them? Or am I required to use Bolt properties for automatic replication?

Comments

  • stanchion
    Options
    Your choices are to use SetAnimator, like this
    state.SetAnimator(GetComponent());

    or use callbacks for each state property you want replicated, like this

    state.AddCallback("atkVar", () => { anim.SetFloat("atkVar", state.atkVar); });
    state.AddCallback("walking", () => { anim.SetBool("walking", state.walking); });
    state.AddCallback("dead", () => { anim.SetBool("dead", state.dead); });
    state.Onattack += AttackTrigger;
  • silentneedle
    edited May 2016
    Options
    I'm currently using SetAnimator, but it seems when I update an animator parameter (e.g. animator.SetInteger) on the owner it doesn't get replicated to the proxies. Of course I've set the animator on the proxies with SetAnimator too.

    Any idea what could be wrong here?

    p.s. updating the position/rotation gets correctly replicated.
  • stanchion
    Options
    Can you show your state settings for each property?
  • silentneedle
    edited May 2016
    Options
    I've found the problem. In my script I was setting the animator by state.SetAnimator(animator), but later in the script I'm updating the animator reference to a newly created runtime animator. It seems bolt caches the set animator, so it updated the old (unused) one.