일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- kubernetes
- call by value
- struct
- overriding
- 최소제곱법
- inheritance
- 지도학습
- 선형모델
- 회귀
- Linear Regression
- Nonlinear Function
- least square
- 비선형모델
- regression
- MapReduce
- call by reference
- 회귀학습
- member function
- 딥러닝
- Nonlinear Model
- Class
- local minimum
- Effective C++
- c++
- 맵리듀스
- 비선형 함수
- virtual function
- Machine learning
- Overloading
- 머신러닝
- Today
- Total
J's Study log
[Unity] Input Mouse Button 본문
Just like Key Input the mouse button have commands like
Input.GetMouseButton(num) - Will continue to happen while you are holding mouse button.
Input.GetMouseButtonDown(num) - Will happen when you hit mouse button.
Input.GetMouseButtonUp(num) - Will happen when you release mouse button.
['num' can be 0(Left Mouse Button) or 1(Right Mouse Button or 2(Central Mouse Button)]
Example code
void Update () {
if (Input.GetMouseButton(0))
{
Debug.Log("left mousebutton");
}
if (Input.GetMouseButtonDown(0))
{
Debug.Log("left mousebutton down");
}
if (Input.GetMouseButtonUp(0))
{
Debug.Log("left mousebutton up");
}
}
And let's find out how to make an event happens, when the mouse clicks specific place. The command is
Input.mousePosition - Reports the position of the mouse even when it is not inside the Game View, such as when Cursor.lockState is set to CursorLockMode.None. When running in windowed mode with an unconfined cursor, position values smaller than 0 or greater than the screen dimensions (Screen.width, Screen.height) indicate that the mouse cursor is outside of the game window.
'Computer Language > Unity' 카테고리의 다른 글
[Unity] Local Transform (0) | 2019.02.27 |
---|---|
[Unity] Parents and Child Object (0) | 2019.02.27 |
[Unity] Input keys (0) | 2019.02.25 |
[Unity] Input Arrow Keys (0) | 2019.02.25 |
[Unity] Camera Work (0) | 2019.02.25 |