[Unity] GetButton, GetButtonDown, GetButtonUp

2021. 6. 22. 12:08UNITY/공부

유니티를 하다가 이런 코드를 본적이 있다.

bool hDown = Input.GetButtonDown("Horizontal");
bool vDown = Input.GetButtonDown("Vertical");
bool hUp = Input.GetButtonUp("Horizontal");
bool vUp = Input.GetButtonUp("Vertical");

vDown 과 vUp을 보고 아 위키와 아래키를 누르는거구나 Input값이 따로 있구나 싶었다.

그래서 확인해본결과

Input Manager

별도로 없음을 확인했다. 그래서 찾아본 결과

 

GetButton : 버튼을 누르는동안

GetButtonDown : 누를때

GetButtonUp : 땔때

 

이렇게 정리할 수 있다.