[Unity] Input System에 대하여

Jung Geun Oh·2025년 7월 25일

Unity

목록 보기
3/4
post-thumbnail

New Input System


Unity's NEW input system in 13 minutes


오늘은 Unity에 Old Input System과 New Input Sytem의 차이점을 알아보고 간략하게 New Input System을 사용하는 방법을 알아보자


항목Old Input SystemNew Input System
기반 구조Input 클래스 기반이벤트 기반 및 C# InputAction 기반
확장성낮음 (플랫폼, 디바이스 확장 어려움)높음 (멀티 디바이스 대응, 리맵, 커스터마이징 가능)
코드 스타일Input.GetKey()Input.GetTouch()InputActionPlayerInput 등 사용
기기 대응키보드, 마우스, 터치 등 제한적게임패드, 모바일, VR/AR, 커스텀 디바이스 대응
입력 설정Unity Editor > Project Settings > InputInputActionAsset 파일(.inputactions)로 시각적 편집
복수 입력 처리멀티터치, 조이패드 등 복잡함다중 디바이스 / 플레이어 인식 우수
학습 난이도낮음 (빠르게 사용 가능)높음 (구조 파악 필요)
지원 여부유지보수만 진행 중 (레거시)공식 권장 (Unity 2021 이후 권장)

Old Input System의 특징


if (Input.GetMouseButtonDown(0)) {
    Debug.Log("마우스 클릭!");
}

float h = Input.GetAxis("Horizontal");

  • Input.GetKey()Input.GetMouseButton()Input.GetAxis() 등을 통해 입력 감지
  • 사용이 매우 간단하고 직관적
  • 단점: 키 리맵, 멀티디바이스, VR/AR 확장 등에 제약 많음


New Input System의 특징


public class PlayerController : MonoBehaviour
{
    public InputAction moveAction;
    public InputActionReference move;

    private Vector2 _moveDirection;

    private void OnEnable() => moveAction.Enable();
    private void OnDisable() => moveAction.Disable();

    void Update()
    {
        // 방법 1
        Vector2 move = moveAction.ReadValue<Vector2>();
        Debug.Log(move);

        // 방법 2 (미리 만들어둔 래퍼런스를 사용하는 방법)
        _moveDirection = move.action.ReadValue<Vector2>();
    }
}
//PlayerInput 컴포넌트 방식도 존재함

  • Input Actions를 SO로 시각적으로 구성
    • .inputactions 파일에서 키맵핑, 액션, 디바이스, 조합 등을 구성

✅ 어떤 걸 써야 할까?

상황추천 시스템
빠른 프로토타입, 간단한 입력만 필요Old Input System (빠름, 쉬움)
멀티 플랫폼, 키 설정 지원, 게임패드/VR 지원 필요New Input System (확장성, 유지보수 용이)
Unity 2022 이상, 협업 프로젝트New Input System 권장


profile
Keep Learning!

0개의 댓글