Animation

Multiple AnimatorControllers
Triggers

Last updated
Was this helpful?
Was this helpful?
using UnityEngine;
using Coherence;
using Coherence.Toolkit;
public class JumpController : MonoBehaviour
{
CoherenceSync coherenceSync;
Animator animator;
void Awake()
{
coherenceSync = GetComponent<CoherenceSync>();
animator = GetComponent<Animator>();
}
void Update()
{
if (!coherenceSync.HasInputAuthority)
{
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)
{
animator.SetTrigger("Jump");
}
}