forked from Tripitaka-Koreana/Virtual-Reality
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.cs
More file actions
34 lines (27 loc) · 1 KB
/
input.cs
File metadata and controls
34 lines (27 loc) · 1 KB
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
32
33
34
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//code.cs라는 스크립트 파일로 만들었음.
public class code : MonoBehaviour
{
// 첫 Update()호출 전 한번만 호출되는 Start()함수
void Start()
{
}
// 매 프레임마다 호출되는 Update()함수
void Update()
{
//키보드 입력 예제
//마우스 입력 메소드: Input.GetKey(키코드)/GetKeyDown(키코드)/GetKeyUp(키코드)/AnyKeyDown(키코드)
//키코드: KeyCode.Return/UpArrow/DownArrow/LeftArrow/RightArrow/Escape/BackSpace/X/S/LeftShift/RightControll/F1 등등
if (Input.GetKey (KeyCode.Space)) {
Debug.Log ("space!");
}
//마우스 입력 예제
//마우스 입력 메소드: Input.GetMouseButton/GetMouseButtonUp/GetMouseButtonDown
//마우스 위치 메소드: Input.MousePosition
if(Input.GetMouseButtonDown(0)){
Debug.Log (Input.mousePosition);
}
}
}