Skip to content

NetworkAnimator does not sync animator trigger parameters #565

@fernando-cortez

Description

@fernando-cortez

Describe the bug
Of the 4 parameters that can be synced on an animator (Float, Int, Bool, Trigger), Trigger is the only one that does not get synced via a network connection.

To Reproduce
Steps to reproduce the behavior:

  1. Create a player prefab with the following components: NetworkObject, Animator, NetworkAnimator, and a generic Player script.
  2. Create an Animator Controller inside your project. Add just a trigger parameter.
  3. Assign this Animator Controller to your player prefab's Animator's "Controller" field.
  4. The NetworkAnimator component should display this trigger field with an empty checkbox. Make sure it is checked on (presumably to make sure it syncs over the network).
  5. Create a GameObject with a NetworkManager component inside your scene. Add the Player prefab to the list of NetworkPrefabs.
  6. Inside the player script, include a way to toggle on/off the trigger if you are the local player (ie. NetworkBehaviour's IsLocalPlayer). Set/reset the animator's trigger with Animator.SetTrigger(..) & Animator.ResetTrigger(..).
  7. You should be able to run a game locally as a host and notice that your local animator's trigger's parameter is modified.
  8. However, if you create a build and do this while in a networked game, you'll find that the networked player's animator is never altered.

Expected behavior
If the trigger parameter is displayed under the NetworkAnimator component with a checkmark next to it toggled on, I would assume that triggers are networked from clients->host & vice-versa.

Screenshots
image

Environment (please complete the following information):

  • OS: Windows 10.
  • Unity Version: e.g. 2020.2.0f1.
  • MLAPI Version: release/0.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions