2月 242021
300円位のジョイスティック mocute-032 を購入したが、実際のボタンの値が分からず確認の為のスクリプトを作成
おそらく、汎用的に確認できます。
この値段で充電式は、驚き!
モードはゲームモードでAndroid
void Update() { UpdateGetKey(); // UpdateKey(); } void UpdateGetKey() { float horizontal = Input.GetAxis("Horizontal"); // joystick horizontal float vertical = Input.GetAxis("Vertical"); // joystick vertical Debug.Log("x y:" + horizontal + "," + vertical); foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKey(value)) { String name = Enum.GetName(typeof(KeyCode), value); Debug.Log("Input.GetKey:" + name); } if (Input.GetKeyDown(value)) { String name = Enum.GetName(typeof(KeyCode), value); Debug.Log("Input.GetKeyDown:" + name); } if (Input.GetKeyUp(value)) { String name = Enum.GetName(typeof(KeyCode), value); Debug.Log("Input.GetKeyUp:" + name); } } }
adb logcat | grep Joy
02-24 13:42:55.463 1346 1358 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000
02-24 13:45:54.033 2993 3016 I Unity : Input.GetKey:JoystickButton2
02-24 13:45:54.033 2993 3016 I Unity : Input.GetKeyDown:JoystickButton2
02-24 13:45:54.033 2993 3016 I Unity : Input.GetKey:Joystick1Button2
02-24 13:45:54.033 2993 3016 I Unity : Input.GetKeyDown:Joystick1Button2
02-24 13:45:54.051 2993 3016 I Unity : Input.GetKeyUp:JoystickButton2
02-24 13:45:54.051 2993 3016 I Unity : Input.GetKeyUp:Joystick1Button2
02-24 13:45:55.333 2993 3016 I Unity : Input.GetKey:JoystickButton0
02-24 13:45:55.333 2993 3016 I Unity : Input.GetKey:Joystick1Button0
02-24 13:45:55.352 2993 3016 I Unity : Input.GetKey:JoystickButton0
02-24 13:45:55.352 2993 3016 I Unity : Input.GetKey:Joystick1Button0
02-24 13:45:55.367 2993 3016 I Unity : Input.GetKey:JoystickButton0
02-24 13:45:55.367 2993 3016 I Unity : Input.GetKey:Joystick1Button0
02-24 13:45:55.383 2993 3016 I Unity : Input.GetKey:JoystickButton0
02-24 13:45:55.383 2993 3016 I Unity : Input.GetKey:Joystick1Button0
02-24 13:45:55.402 2993 3016 I Unity : Input.GetKeyUp:JoystickButton0