콜백 방식을 자주 까먹어서 기록
namespace TEST { using UnityEngine; using UnityEngine.InputSystem; public class APPInputManager : MonoBehaviour, AppInputControls.IPlayerContollerActionMapActions { private AppInputControls _Inputs; private void Awake() { _Inputs = new AppInputControls(); _Inputs.Enable(); _Inputs.PlayerContollerActionMap.SetCallbacks(this); } #region 항상 확인 private void Update() { Debug.LogFormat($"<color=green>WASD Key : {_Inputs.PlayerContollerActionMap.WASD_Test.ReadValue<Vector2>()}</color>"); } #endregion #region CallBack 방식 void AppInputControls.IPlayerContollerActionMapActions.OnMouse_Left(InputAction.CallbackContext context) { if (context.performed) // 버튼이 눌린 순간 이벤트 발생 Debug.LogFormat($"<color=white>마우스 버튼 : {context.performed}</color>"); if (context.canceled) // 버튼을 뗀 순간 이벤트 발생 Debug.LogFormat($"<color=red>마우스 버튼 : {context.performed}</color>"); } void AppInputControls.IPlayerContollerActionMapActions.OnWASD_Test(InputAction.CallbackContext context) { Vector2 movementInput = context.ReadValue<Vector2>(); Debug.LogFormat($"WASD Key : {movementInput}"); } #endregion } }