Skip to content

Instantly share code, notes, and snippets.

@negipoyoc
Created October 16, 2018 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save negipoyoc/8396dc1760d6f20f187f7e85337c05cc to your computer and use it in GitHub Desktop.
Save negipoyoc/8396dc1760d6f20f187f7e85337c05cc to your computer and use it in GitHub Desktop.
Switchコントローラーを自分の環境で使うときに調べたマッピング
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