Switchコントローラーを自分の環境で使うときに調べたマッピング
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SwitchControllerMapping : MonoBehaviour { | |
void Update () { | |
// Joy-Con(R) | |
var rh = Input.GetAxis("R_Horizontal"); | |
var rv = Input.GetAxis("R_Vertical"); | |
// Joy-Con(L) | |
var lh = Input.GetAxis("L_Horizontal"); | |
var lv = Input.GetAxis("L_Vertical"); | |
//L_Left | |
if (Input.GetKey(KeyCode.Joystick1Button0)) | |
{ | |
Debug.Log("L_LeftButton"); | |
} | |
//L_Up | |
if (Input.GetKey(KeyCode.Joystick1Button2)) | |
{ | |
Debug.Log("L_UpButton"); | |
} | |
//L_Down | |
if (Input.GetKey(KeyCode.Joystick1Button1)) | |
{ | |
Debug.Log("L_DownButton"); | |
} | |
//L_Right | |
if (Input.GetKey(KeyCode.Joystick1Button3)) | |
{ | |
Debug.Log("L_RightButton"); | |
} | |
//L_L | |
if (Input.GetKey(KeyCode.Joystick1Button14)) | |
{ | |
Debug.Log("LTrigger"); | |
} | |
//L_ZL | |
if (Input.GetKey(KeyCode.Joystick1Button15)) | |
{ | |
Debug.Log("ZLTrigger"); | |
} | |
//L_SR | |
if (Input.GetKey(KeyCode.Joystick1Button5)) | |
{ | |
Debug.Log("L_SRButton"); | |
} | |
//L_SL | |
if (Input.GetKey(KeyCode.Joystick1Button4)) | |
{ | |
Debug.Log("L_SLButton"); | |
} | |
//L_Plus | |
if (Input.GetKey(KeyCode.Joystick1Button8)) | |
{ | |
Debug.Log("MinusButton"); | |
} | |
//L_Capture | |
if (Input.GetKey(KeyCode.Joystick1Button13)) | |
{ | |
Debug.Log("CaptureButton"); | |
} | |
//L_R StickButton | |
if (Input.GetKey(KeyCode.Joystick1Button10)) | |
{ | |
Debug.Log("LStickPush"); | |
} | |
//R_Y | |
if (Input.GetKey(KeyCode.Joystick2Button3)) | |
{ | |
Debug.Log("YButton"); | |
} | |
//R_X | |
if (Input.GetKey(KeyCode.Joystick2Button1)) | |
{ | |
Debug.Log("XButton"); | |
} | |
//R_B | |
if (Input.GetKey(KeyCode.Joystick2Button2)) | |
{ | |
Debug.Log("BButton"); | |
} | |
//R_A | |
if (Input.GetKey(KeyCode.Joystick2Button0)) | |
{ | |
Debug.Log("AButton"); | |
} | |
//R_R | |
if (Input.GetKey(KeyCode.Joystick2Button14)) | |
{ | |
Debug.Log("R_Trigger"); | |
} | |
//R_ZR | |
if (Input.GetKey(KeyCode.Joystick2Button15)) | |
{ | |
Debug.Log("ZRTrigger"); | |
} | |
//R_SR | |
if (Input.GetKey(KeyCode.Joystick2Button5)) | |
{ | |
Debug.Log("R_SRButton"); | |
} | |
//R_SL | |
if (Input.GetKey(KeyCode.Joystick2Button4)) | |
{ | |
Debug.Log("R_SLButton"); | |
} | |
//R_Plus | |
if (Input.GetKey(KeyCode.Joystick2Button9)) | |
{ | |
Debug.Log("PlusButton"); | |
} | |
//R_Home | |
if (Input.GetKey(KeyCode.Joystick2Button12)) | |
{ | |
Debug.Log("HomeButton"); | |
} | |
//R_StickPush | |
if (Input.GetKey(KeyCode.Joystick2Button11)) | |
{ | |
Debug.Log("R_StickPushButton"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment