using UnityEngine; using UnityEngine.InputSystem; [RequireComponent(typeof(PlayerInput))] public class Block : MonoBehaviour { public bool blocking = false; private InputActionAsset actions; private void Start() { actions = GetComponent().actions; } private void Update() { InputAction blockAction = actions.FindAction("Block"); if (blockAction.ReadValue() == 1f) { blocking = true; } else { blocking = false; } GetComponent().block = blocking; } }