using System; using UnityEngine; using UnityEngine.InputSystem; public class InputManager : MonoBehaviour { public static InputManager Instance; //인풋 매니저는 눌린 키에 대한 이벤트만 실행함. 어떤 로직이 등록되어있는지는 모른다. public event Action XRLeftControllerPrimaryButton_Event; private void Awake() { if (Instance == null) { Instance = this; //만들어진 자신을 인스턴스로 설정 } else { Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴 } } public void XRLeftControllerPrimaryButton(InputAction.CallbackContext ctx) { if(ctx.started) XRLeftControllerPrimaryButton_Event?.Invoke(); } #region 테스트용(키보드) public void XRLeftControllerPrimaryButton_Test_KeyNum1(InputAction.CallbackContext ctx) { if(ctx.started) XRLeftControllerPrimaryButton_Event?.Invoke(); } #endregion }