bCanChangeGamepadType

bCanChangeGamepadType

#Overview

name: bCanChangeGamepadType

The value of this variable can be defined or overridden in .ini config files. 11 .ini config files referencing this setting variable.

It is referenced in 11 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bCanChangeGamepadType is to indicate whether the current platform supports changing the gamepad type during runtime. This setting is primarily used in the input system of Unreal Engine 5, specifically within the CommonUI plugin’s input management functionality.

The CommonUI plugin and the Core module of Unreal Engine rely on this setting variable. It is used in the CommonInput subsystem, which is part of the CommonUI plugin, and also in the DataDrivenPlatformInfoRegistry, which is part of the Core module.

The value of this variable is typically set in the UCommonInputPlatformSettings class constructor and can be initialized from platform-specific information. It can also be loaded from configuration files, as seen in the LoadDDPIIniSettings function.

This variable interacts with other input-related variables such as bSupportsGamepad, bSupportsMouseAndKeyboard, and bSupportsTouch. These variables collectively define the input capabilities of a platform.

Developers must be aware that this variable affects the ability to change gamepad types at runtime. If set to false, the game may not allow users to switch between different gamepad configurations dynamically.

Best practices when using this variable include:

  1. Ensure it is correctly set for each platform your game supports.
  2. Use it in conjunction with other input-related settings to provide a consistent input experience across different platforms.
  3. If your game supports multiple gamepad types, make sure to check this variable before allowing users to change gamepad configurations.
  4. Consider the implications on user interface and control schemes if this variable is set to false on certain platforms.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:9, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/IOS/DataDrivenPlatformInfo.ini:9, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/Linux/DataDrivenPlatformInfo.ini:10, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/LinuxArm64/DataDrivenPlatformInfo.ini:11, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:10, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:16, section: [DataDrivenPlatformInfo]

Location: <Workspace>/Projects/Lyra/Config/Android/AndroidGame.ini:7, section: [CommonInputPlatformSettings_Android CommonInputPlatformSettings]

Location: <Workspace>/Projects/Lyra/Config/IOS/IOSGame.ini:8, section: [CommonInputPlatformSettings_IOS CommonInputPlatformSettings]

Location: <Workspace>/Projects/Lyra/Config/Linux/LinuxGame.ini:7, section: [CommonInputPlatformSettings_Linux CommonInputPlatformSettings]

Location: <Workspace>/Projects/Lyra/Config/Mac/MacGame.ini:7, section: [CommonInputPlatformSettings_Mac CommonInputPlatformSettings]

Location: <Workspace>/Projects/Lyra/Config/Windows/WindowsGame.ini:7, section: [CommonInputPlatformSettings_Windows CommonInputPlatformSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Private/CommonInputBaseTypes.cpp:217

Scope (from outer to inner):

file
function     UCommonInputPlatformSettings::UCommonInputPlatformSettings

Source code excerpt:

	bSupportsMouseAndKeyboard = false;
	bSupportsGamepad = true;
	bCanChangeGamepadType = true;
	bSupportsTouch = false;
	DefaultGamepadName = FCommonInputDefaults::GamepadGeneric;
}

void UCommonInputPlatformSettings::PostLoad()
{

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Private/CommonInputBaseTypes.cpp:263

Scope (from outer to inner):

file
function     void UCommonInputPlatformSettings::InitializePlatformDefaults

Source code excerpt:

	bSupportsMouseAndKeyboard = PlatformInfo.bSupportsMouseAndKeyboard;
	bSupportsGamepad = PlatformInfo.bSupportsGamepad;
	bCanChangeGamepadType = PlatformInfo.bCanChangeGamepadType;
	bSupportsTouch = PlatformInfo.bSupportsTouch;

	DefaultGamepadName = PlatformName;
}

bool UCommonInputPlatformSettings::TryGetInputBrush(FSlateBrush& OutBrush, FKey Key, ECommonInputType InputType, const FName GamepadName) const

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Private/CommonInputSettings.cpp:193

Scope (from outer to inner):

file
function     void UCommonInputSettings::PostInitProperties

Source code excerpt:

				Settings->bSupportsGamepad = OriginalData.bSupportsGamepad;
				Settings->bSupportsTouch = OriginalData.bSupportsTouch;
				Settings->bCanChangeGamepadType = OriginalData.bCanChangeGamepadType;
				Settings->DefaultGamepadName = OriginalData.DefaultGamepadName;
				Settings->DefaultInputType = OriginalData.DefaultInputType;
				Settings->ControllerData = OriginalData.ControllerData;

				Settings->TryUpdateDefaultConfigFile();
			}

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Private/CommonInputSettings.cpp:214

Scope (from outer to inner):

file
function     void UCommonInputSettings::PostInitProperties

Source code excerpt:

						PCPlatform->bSupportsGamepad = OriginalData.bSupportsGamepad;
						PCPlatform->bSupportsTouch = OriginalData.bSupportsTouch;
						PCPlatform->bCanChangeGamepadType = OriginalData.bCanChangeGamepadType;
						PCPlatform->DefaultGamepadName = OriginalData.DefaultGamepadName;
						PCPlatform->DefaultInputType = OriginalData.DefaultInputType;
						PCPlatform->ControllerData = OriginalData.ControllerData;

						PCPlatform->TryUpdateDefaultConfigFile();
					}

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Public/CommonInputBaseTypes.h:240

Scope (from outer to inner):

file
class        class UCommonInputPlatformSettings : public UPlatformSettings
function     bool CanChangeGamepadType

Source code excerpt:

	bool CanChangeGamepadType() const 
	{
		return bCanChangeGamepadType;
	}

	TArray<TSoftClassPtr<UCommonInputBaseControllerData>> GetControllerData()
	{
		return ControllerData;
	}

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Public/CommonInputBaseTypes.h:273

Scope (from outer to inner):

file
class        class UCommonInputPlatformSettings : public UPlatformSettings

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = "Default", Meta = (EditCondition = "bSupportsGamepad"))
	bool bCanChangeGamepadType;

	UPROPERTY(config, EditAnywhere, Category = "Default", Meta = (TitleProperty = "InputType"))
	TArray<TSoftClassPtr<UCommonInputBaseControllerData>> ControllerData;

	UPROPERTY(Transient)
	mutable TArray<TSubclassOf<UCommonInputBaseControllerData>> ControllerDataClasses;

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Public/CommonInputBaseTypes.h:296

Scope (from outer to inner):

file
function     FCommonInputPlatformBaseData

Source code excerpt:

		bSupportsMouseAndKeyboard = false;
		bSupportsGamepad = true;
		bCanChangeGamepadType = true;
		bSupportsTouch = false;
		DefaultGamepadName = FCommonInputDefaults::GamepadGeneric;
	}
	virtual ~FCommonInputPlatformBaseData() = default;

	virtual bool TryGetInputBrush(FSlateBrush& OutBrush, FKey Key, ECommonInputType InputType, const FName& GamepadName) const;

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Public/CommonInputBaseTypes.h:341

Scope (from outer to inner):

file
function     bool CanChangeGamepadType

Source code excerpt:

	bool CanChangeGamepadType() const 
	{
		return bCanChangeGamepadType;
	}

	TArray<TSoftClassPtr<UCommonInputBaseControllerData>> GetControllerData()
	{
		return ControllerData;
	}

#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonInput/Public/CommonInputBaseTypes.h:365

Scope: file

Source code excerpt:


	UPROPERTY(EditDefaultsOnly, Category = "Gamepad", Meta = (EditCondition = "bSupportsGamepad"))
	bool bCanChangeGamepadType;

	UPROPERTY(EditDefaultsOnly, Category = "Properties")
	bool bSupportsTouch;

	UPROPERTY(EditDefaultsOnly, Category = "Properties", Meta = (TitleProperty = "GamepadName"))
	TArray<TSoftClassPtr<UCommonInputBaseControllerData>> ControllerData;

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Misc/DataDrivenPlatformInfoRegistry.cpp:358

Scope (from outer to inner):

file
function     static void LoadDDPIIniSettings

Source code excerpt:

	DDPIGetBool(IniFile, TEXT("bSupportsMouseAndKeyboard"), Info.bSupportsMouseAndKeyboard);
	DDPIGetBool(IniFile, TEXT("bSupportsGamepad"), Info.bSupportsGamepad);
	DDPIGetBool(IniFile, TEXT("bCanChangeGamepadType"), Info.bCanChangeGamepadType);
	DDPIGetBool(IniFile, TEXT("bSupportsTouch"), Info.bSupportsTouch);

	DDPIGetName(IniFile, TEXT("OverrideCookPlatformName"), Info.OverrideCookPlatformName);

#if DDPI_HAS_EXTENDED_PLATFORMINFO_DATA

#Loc: <Workspace>/Engine/Source/Runtime/Core/Public/Misc/DataDrivenPlatformInfoRegistry.h:156

Scope: file

Source code excerpt:

	bool bSupportsMouseAndKeyboard = false;
	bool bSupportsGamepad = true;
	bool bCanChangeGamepadType = true;
	bool bSupportsTouch = false;

	// the compression format that this platform wants; overrides game unless bForceUseProjectCompressionFormat
	FString HardwareCompressionFormat;

	/** Platform name to be used for cooking (note: DOES NOT include the configuration name, eg "Server", "Client", only the platform name) */