Right out of the box, the Common Input Base Controller Data does not initially support Horizontal single stick use in the Common Input Settings.
I was able to figure a way to support Single horizontal, Dual JoyCon & ProController environments using Common Input Settings.
Setting the right configurations within the Project Settings:
Project Settings > Platforms
.Create Left and Right JoyCon folders:
Engine\\Platforms
directory, create two new folders: LeftJoyCon
and RightJoyCon
.Set up the Configuration File:
DataDrivenPlatformInfo.ini
file into each Config folder.Modify Configuration File:
Switch_Left_JoyCon
and Switch_Right_JoyCon
respectively.Set Up Common Input Settings:
This allows for differentiation between Switch
, SwitchLeftJoyCon
, and SwitchRightJoyCon
controllers inside the Common Input Settings.
Under Common Input Base Controller data, ensure the Gamepad Name dropdown includes options for "Switch", "SwitchLeftJoyCon", or "SwitchRightJoyCon".
Configure Gamepad Hardware ID Mapping:
Ensure the Common Input Base Controller Data has the correct Gamepad Hardware ID mapping set up for all three Controller Datas.
Create Custom Logic for a Force Refresh Current Input Method :
I am using the function called void RefreshCurrentInputMethod
that lives inside CommonInputSubsystem.cpp*.* Since that function is private, I had to create my own function called ForceRefreshCurrentInputMethod
to force update the current input method since I needed call it inside the function:
void UCommonUIActionRouterBase::ApplyUIInputConfig()
This is how I can guarantee whenever a JoyCon gets calibrated, it will refresh the current input method.
Implement Custom Controller Selection Logic for the Nintendo Switch JoyCon:
FName UCommonInputPlatformSettings::GetBestGamepadNameForHardware(FName CurrentGamepadName, FName InputDeviceName, const FString& HardwareDeviceIdentifier)
FName UCommonInputPlatformSettings::GetBestGamepadNameForHardware()
we want to implement our custom logic to detect which Controller Data is best for our current setting and have it return the correct FName. By Default it will always call "Switch" which is why we had to set up the Config files.CurrentGamepadName
is one of the three JoyCon data controllers, then selects the best JoyCon type (left or right) based on the HardwareDeviceIdentifier
. Finally, it assigns the selected JoyCon type to be used for the gamepad input mapping which then returns the correct FName.By following these steps, I enable support for Single horizontal, Dual JoyCon & ProController environments using Common Input Settings on the Switch platform!