UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"play animation on action"
using UnityEngine; public class PlayAnimationOnAction : MonoBehaviour { public Animator animator; public string animationTrigger; // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { PlayAnimation(); } } void PlayAnimation() { /* Trigger the animation */ animator.SetTrigger(animationTrigger); } }