nintendo switch joy con support

i’m getting an error when i have my joy cons connected to my pc, does anyone know if it’s possible to use the nintendo switch joy cons in the new input system or if it is a planned feature at any point? would be a great addition for local co-op etc

the error is this but it’s not very usefull - basically just saying the controller format isn’t implemented i guess
NotImplementedException: The method or operation is not implemented.
UnityEngine.InputSystem.Utilities.PrimitiveValue.FromString (System.String value) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview.3/InputSystem/Utilities/PrimitiveValue.cs:407)

According to the documentation, Joy-Cons aren’t currently supported, only Switch Pro Controllers:

The Input System support Switch Pro controllers on desktop computers via the SwitchProControllerHIDclass, which implements basic gamepad functionality.

If you have the time, it is possible to set up custom controller support (including for Joy-Cons) yourself. I’m sure many others would appreciate the contribution, but it looks like it would be rather time-consuming.

1 Like

Funny that you post this! I am currently working with the same. I am able to connect my JoyCons into the InputSystem but they’re hard to recognise and I am not able to read analog values from the JoyCons.

I have the weird issue that I am not able to connect the JoyCons beforehand, but if I connect the JoyCons while the game is running, everything seems to work (Joysticks only give me (1,0,-1) values but other than that it works okay.

I am using a Mac, so it might not be possible on Windows at all, I have no clue. On Mac however it works to some degree.

I just pair the JoyCons up with the Mac and I am able to listen for their input in the Input Actions.

i figured it wasn’t supported yet, just wanted to confirm and didn’t realise there was a document for it, thanks :slight_smile:

mine is probably getting completely messed up due to having vjoy installed then as it still errors even with them removed from the list of installed devices

What system are you on? Mac or PC?

PC, i removed the vjoy drivers and it no longer errors so that’s good as it was annoying that it errors even with the joycons removed from device manager.
i have a couple xbox controllers i can use for now till joycon support gets added

Awesome. I’ll probably do the same. I have a PS4 Controller lying around somewhere and I’ll use that in the meantime. Let’s hope that JoyCon support will come. :slight_smile:

We’re currently still having multiple issues with our HID fallback that kicks in when a HID is connected that isn’t specifically recognized by the input system (which is the case with JoyCons on desktop). In some cases, the HID fallback just wires up the device incorrectly, in others it leads to exceptions being thrown. We’re working on it.

Proper Joy-Con support on desktop is planned for after 1.0.

4 Likes

Hey @Rene-Damm Awesome thanks for your reply! I think I won’t need to set it up using custom scripts. I’ll stick to what they can do right now. They do sort of work and that’s okay so far. It’s just a passion project so I was just curious!

yh they work ok without the vjoy drivers on windows too, just a couple issues but it’s good enough to do dev tests, looking forward to full support :slight_smile:

1 Like

How do you get it to work?? It’s not working for me for some reason. I have my pro controller connected to my pc and Unity shows on the console: "Joystick Reconnected (“Pro Controller”). but whenever I try to use the “Listen” button for the keybinding it doesn’t take any input.

same. also in the debug controls window, it doesn’t update values (but the ds4 works fine here)

Hello,
Is JoyCon still planned to be supported after version 1.0? And do you have a best guess of when this might be?
Many thanks,

It’s still the plan but there’s no concrete ETA yet. 1.1 will focus mainly on fixes and performance improvements. Beyond that the timeline is still uncertain. Sorry I don’t have better news at this point :confused:

what’s the perf drop compared to the old input system?

1 Like

@Rene-Damm , is there any update on this (if it is compatible or an estimated date on when it will be), as we are currently (January 26th) on version 1.1.0-preview.2?

Aside from the input (button presses), are there any issues with receiving sensor information from these joycons (i.e. gyroscope/accelerometer)?

Thank you.

Also waiting for an update regarding the JoyCon support. In the meantime, did anyone manage to setup a custom controller that supports them? Any pointers in the right direction would be appreciated.

These are the result of me trying to follow the wondrous journey of confusion that is the input system guide pages and adapt the ps4 controller example.
I remapped the controller to be two half-controllers but i mapped SL and SR to L3 and R3 and did not map the stick press itself. Also the Stick is read as a dpad for some reason, so not analog.
There is a lot you can improve on this, i would call this a work in progress but it works for me.

using System.Runtime.InteropServices;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Utilities;

[StructLayout(LayoutKind.Explicit, Size = 32)]
struct LeftJoyconInputReport : IInputStateTypeInfo
{
    // Because all HID input reports are tagged with the 'HID ' FourCC,
    // this is the format we need to use for this state struct.
    public FourCC format => new FourCC('H', 'I', 'D');

    [InputControl(name = "buttonSouth", displayName = "Down", bit = 1)]
    [InputControl(name = "buttonWest", displayName = "Left", bit = 0)]
    [InputControl(name = "buttonEast", displayName = "Right", bit = 3)]
    [InputControl(name = "buttonNorth", displayName = "Up", bit = 2)]
    [InputControl(name = "leftStickPress", displayName = "SL", bit = 4)]
    [InputControl(name = "rightStickPress", displayName = "SR", bit = 5)]
    [FieldOffset(1)] public byte buttons1;

    //Stickpress is not assigned
    //    [InputControl(name = "leftStickPress", displayName = "StickPress", bit = 2)]
    [InputControl(name = "start", displayName = "Minus", bit = 0)]
    [InputControl(name = "select", displayName = "Cam", bit = 5)]
    [InputControl(name = "leftTrigger", displayName = "Trigger", format = "BIT", bit = 7)]
    [InputControl(name = "leftShoulder", displayName = "Shoulder", bit = 6)]
    [FieldOffset(2)] public byte buttons2;

    [InputControl(name = "dpad", format = "BIT", layout = "Dpad", sizeInBits = 4, defaultState = 8)]
    [InputControl(name = "dpad/up", format = "BIT", layout = "DiscreteButton", parameters = "minValue=5,maxValue=7", bit = 0, sizeInBits = 4)]
    [InputControl(name = "dpad/right", format = "BIT", layout = "DiscreteButton", parameters = "minValue=7,maxValue=1,nullValue=8,wrapAtValue=7", bit = 0, sizeInBits = 4)]
    [InputControl(name = "dpad/down", format = "BIT", layout = "DiscreteButton", parameters = "minValue=1,maxValue=3", bit = 0, sizeInBits = 4)]
    [InputControl(name = "dpad/left", format = "BIT", layout = "DiscreteButton", parameters = "minValue=3, maxValue=5", bit = 0, sizeInBits = 4)]
    [FieldOffset(3)] public byte leftStickX;
}

[StructLayout(LayoutKind.Explicit, Size = 32)]
struct RightJoyconInputReport : IInputStateTypeInfo
{
    // Because all HID input reports are tagged with the 'HID ' FourCC,
    // this is the format we need to use for this state struct.
    public FourCC format => new FourCC('H', 'I', 'D');

    [InputControl(name = "buttonSouth", displayName = "Down", bit = 2)]
    [InputControl(name = "buttonWest", displayName = "Left", bit = 3)]
    [InputControl(name = "buttonEast", displayName = "Right", bit = 0)]
    [InputControl(name = "buttonNorth", displayName = "Up", bit = 1)]
    [InputControl(name = "leftStickPress", displayName = "SL", bit = 4)]
    [InputControl(name = "rightStickPress", displayName = "SR", bit = 5)]
    [FieldOffset(1)] public byte buttons1;

    //Stickpress is not assigned

    //   [InputControl(name = "rightStickPress", displayName = "StickPress", bit = 3)]
    [InputControl(name = "start", displayName = "Plus", bit = 1)]
    [InputControl(name = "select", displayName = "Home", bit = 4)]
    [InputControl(name = "rightTrigger", displayName = "Trigger", bit = 7, format = "BIT")]
    [InputControl(name = "rightShoulder", displayName = "Shoulder", bit = 6)]
    [FieldOffset(2)] public byte buttons2;

    [InputControl(name = "dpad", format = "BIT", layout = "Dpad", sizeInBits = 4, defaultState = 8)]
    [InputControl(name = "dpad/up", format = "BIT", layout = "DiscreteButton", parameters = "minValue=1,maxValue=3", bit = 0, sizeInBits = 4)]
    [InputControl(name = "dpad/right", format = "BIT", layout = "DiscreteButton", parameters = "minValue=3,maxValue=5", bit = 0, sizeInBits = 4)]
    [InputControl(name = "dpad/down", format = "BIT", layout = "DiscreteButton", parameters = "minValue=5, maxValue=7", bit = 0, sizeInBits = 4)]
    [InputControl(name = "dpad/left", format = "BIT", layout = "DiscreteButton", parameters = "minValue=7,maxValue=1,nullValue=8,wrapAtValue=7", bit = 0, sizeInBits = 4)]
    [FieldOffset(3)] public byte rightStickX;
}
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;

[InputControlLayout(stateType = typeof(LeftJoyconInputReport))]
#if UNITY_EDITOR
[InitializeOnLoad] // Make sure static constructor is called during startup.
#endif
public class LeftJoyconGamepadHID : Gamepad
{
    static LeftJoyconGamepadHID()
    {
        InputSystem.RegisterLayout<LeftJoyconGamepadHID>(
            matches: new InputDeviceMatcher()
                .WithInterface("HID")
                .WithCapability("vendorId", 0x57E) // Nintendo
                .WithCapability("productId", 0x2006)); // L


    }

    // In the Player, to trigger the calling of the static constructor,
    // create an empty method annotated with RuntimeInitializeOnLoadMethod.
    [RuntimeInitializeOnLoadMethod]
    static void Init() {}
}
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;

[InputControlLayout(stateType = typeof(RightJoyconInputReport))]
#if UNITY_EDITOR
[InitializeOnLoad] // Make sure static constructor is called during startup.
#endif
public class RightJoyconGamepadHID : Gamepad
{
    static RightJoyconGamepadHID()
    {
        InputSystem.RegisterLayout<RightJoyconGamepadHID>(
            matches: new InputDeviceMatcher()
                .WithInterface("HID")
                .WithCapability("vendorId", 0x57E)//Nintendo
                .WithCapability("productId", 0x2007)); //R
    }

    // In the Player, to trigger the calling of the static constructor,
    // create an empty method annotated with RuntimeInitializeOnLoadMethod.
    [RuntimeInitializeOnLoadMethod]
    static void Init() {}
}
3 Likes

Awesome, thanks!

Hi @Rene-Damm , is there any update on using JoyCons (button press and sensor data) with the new Input System (if it is compatible or an estimated date on when it will be)?

Thank you.