Animations
Unity Animator's parameters are bindable out of the box, with the exception of triggers.

Triggers
Triggers can be invoked over the network using commands. Here's an example where we inform networked clients that we have played a jump animation:
using UnityEngine;
using Coherence.Toolkit;
using System.Collections.Generic;
public class JumpController : MonoBehaviour
{
CoherenceSync coherenceSync;
Animator animator;
void Awake()
{
coherenceSync = GetComponent<CoherenceSync>();
animator = GetComponent<Animator>();
}
void Update()
{
if (!coherenceSync.isSimulated)
{
return;
}
if (Input.GetKeyDown(KeyCode.Space))
{
MakePlayerJump();
}
}
void MakePlayerJump()
{
coherenceSync.SendCommand<JumpController>(nameof(PlayJumpAnimation), MessageTarget.All, coherenceSync);
}
// bind to this method via the Bindings window
public void PlayJumpAnimation(CoherenceSync jumpSync)
{
var animator = GetComponent<Animator>();
animator.SetTrigger("Jump");
}
}
Now, bind to PlayJumpAnimator
.

Last updated
Was this helpful?