Search Unity

Resolved NetworkAnimator ResetTrigger not working properly on client-side.

Discussion in 'Netcode for GameObjects' started by TestifyNow, Sep 30, 2022.

  1. TestifyNow

    TestifyNow

    Joined:
    Feb 9, 2016
    Posts:
    24
    Consider two animations: Idle and Run

    I switch to Run/Idle via triggers from code, on OwnerNetworkAnimator (client-side authority)

    I set triggers like this:
    Code (CSharp):
    1. ownerNetworkAnimator.SetTrigger("Idle");
    and it seems to work, but sometimes, due to (probably) lag, the trigger for Idle stays "on" even while in Idle.

    In a normal game, this issue can be solved by Resetting trigger, so that's what I did here.
    The problem is, it doesn't seem to work at all like intended. Instead of setting the trigger to false, it seems trigger it on and off, or just on. Moreover, the animation seems to work fine on the server, but on client, it glitches out.

    My current workaround is so to first call all those on OwnerNetworkAnimator, and then on animator directly locally, but hey, why is it needed in the first place?
     
    Last edited: Sep 30, 2022
    modaka-cov likes this.
  2. modaka-cov

    modaka-cov

    Joined:
    Jul 5, 2021
    Posts:
    3
    I'm also facing the same issue.
     
  3. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    440
    Triggers are currently not synchronized over the network by the NetworkAnimator. You need to use an RPC to change them.