About
Contents
STL
Android
Eigen
enchant.js
Firefox OS
OpenGL
OpenGL ES 2.0
pukiwiki
UE4
Unity
Windows Phone
Xamarin
Materials Link
その他
PR
STL
Android
Eigen
enchant.js
Firefox OS
OpenGL
OpenGL ES 2.0
pukiwiki
UE4
Unity
Windows Phone
Xamarin
以前のリビジョンの文書です
Inputクラスを使って、ユーザーの入力情報を受け取ります。
if (Input.GetKeyDown("a")) { Debug.Log("a!"); } if (Input.GetButtonDown("Jump")) { Debug.Log("Jump!"); } if (Input.GetKeyDown("up")) { Debug.Log("up!"); }
if (Input.GetKeyUp("b")) { Debug.Log("b!"); } if (Input.GetButtonUp("Fire1")) { Debug.Log("Fire1!"); }
if (Input.GetKey("c")) { Debug.Log("c!"); } if (Input.GetButton("Fire2")) { Debug.Log("Fire2!"); }
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
if (Input.GetMouseButtonDown(0)) { Debug.Log("Left Click!"); // 左クリック。 } if (Input.GetMouseButtonDown(1)) { Debug.Log("Right Click!"); // 右クリック。 } if (Input.GetMouseButtonDown(2)) { Debug.Log("Center Click!"); // 中央クリック。 }
GetMouseButtonDown( 0 ) はシングルタッチと同等です。
Vector2 mousePos = Input.mousePosition;
float wheel = Input.GetAxis("Mouse ScrollWheel");
for( int i = 0; i < Input.touchCount; i++ ) { Touch touch = Input.GetTouch(i); Vector2 pos = touch.position; switch( touch.phase ) { case Began: print( "touch Began!" ); // タッチ開始。 break; case Moved: print( "touch Moved!" ); // タッチしていて移動中。 break; case Stationary: print( "touch Stationary!" ); // タッチしているが移動していない。 break; case Ended: print( "touch Ended!" ); // タッチ終了(離した)。 break; case Canceled: // システムによってキャンセルした。 print( "touch Canceled!" ); break; }; }
Vector3 lowPassValue = Input.acceleration;
Input.gyro.enabled = true;