1.2. Animation parameters

Using the same scene as in the previous lesson, let's see how to easily sync animation over the network.

Key controls

  • WASD or Left stick: Move character

  • Hold Shift or Shoulder button left: Run

  • Spacebar or Joypad button down: Jump

Topics covered

Animation | Bindings

In this scene...

We haven't mentioned it before, but the player Prefab does a lot more than just syncing its position and rotation.

If you perform the actions mentioned in the controls, you will notice that animation is also replicated across Clients. This is done via synced Animator parameters (and Network Commands, but we cover these in the next lesson).

Very much like in the example about position and rotation, just sending these across the network allows us to synchronize of the state of animation, making it look like network-instantiated Prefabs on other Clients (the other players) are performing actions.

How it's set up

Open the player Prefab located in the Characters/Player __ folder. Browse the Hierarchy until you find the sub-object called PlayerModel. You will notice it has an Animator component. Select this object and open the Animator window.

As you can imagine, animation is controlled by a few parameters of different types (int, bool, float).

Make sure to keep the GameObject with the Animator component selected, and open the coherence Configure window:

You will see that a group of animation parameters are being synced. It's that simple: just checking them will start sending the values across, once the game starts.

Did you notice that you are able to configure bindings even if this particular GameObject doesn't have a CoherenceSync component on it? This is done via the one attached to the root of the player Prefab. These parameters are what we call deep bindings. Learn more in the Complex hierarchies lesson.

There is only one piece missing: animation triggers. They are not a variable holding a value that changes over time, but rather an action that happens instantaneously, so we will see how to sync them in the next lesson using Network Commands.

Last updated