Start 1: 2025/02/04 13:43 ~ 2025/02/04 15:40B6 00:00 ~ B6 27:34

Start 2: 2025/02/04 19:30 ~ 2025/02/04 19:58B6 27:35 ~ B6 48:51

Start 3: 2025/02/04 21:17 ~ 2025/02/04 21:24B8 00:00 ~ B8 03:02Complete

⇒ Unity 내장 Input Class의 Event Trigger 학습하기

키 입력

Class → ‘Input’

Key

  1. anyKeyDown
  2. anyKey

실행 화면

image.png

플레이어 움직임 제어(키보드)

Down(누르기), Stay(누른 상태 지속), Up(버튼에서 떼기)

  1. GetKeyDown()
  2. GetKey()
  3. GetKeyUp()

실행 화면

image.png

플레이어 움직임 제어(마우스)

Down(누르기), Stay(누른 상태 지속), Up(버튼에서 떼기)

  1. GetMouseButtonDown()
  2. GetMouseButton()
  3. GetMouseButtonUp()

매개변수 형태

0 : Mouse Left Click

1 : Mouse Right Click

실행 화면

image.png

image.png

버튼 설정 및 입력

버튼방식: 유니티에서 공식적으로 지정해준 키를 가지고 쓰는 것

플레이어 움직임 제어(Unity 자체 제공)

Down(누르기), Stay(누른 상태 지속), Up(버튼에서 떼기)

  1. GetButtonDown()
  2. GetButton()
  3. GetButtonUp()

Edit → Project Settings → Input

image.png

Ex) Horizontal

image.png