using UnityEngine; using UnityEngine.InputSystem; [RequireComponent(typeof(PlayerInput))] [RequireComponent(typeof(AnimationPlayer))] public class Punch : MonoBehaviour { InputActionAsset actions; private void Start() { actions = GetComponent().actions; } private void Update() { if (actions.FindAction("Punch").ReadValue() == 1f) { GetComponent().Punch(); } } }