DefaultGamepadName

DefaultGamepadName

#Overview

name: DefaultGamepadName

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

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DefaultGamepadName is to specify the default name or identifier for the gamepad input device in Unreal Engine 5. This setting variable is primarily used within the Common Input system, which is part of the CommonUI plugin.

The CommonUI plugin, specifically the CommonInput module, relies on this setting variable. It is used in various classes and functions related to input handling and platform-specific settings.

The value of this variable is typically set in the following ways:

  1. In the UCommonInputPlatformSettings constructor, it’s initialized with FCommonInputDefaults::GamepadGeneric.
  2. In the InitializePlatformDefaults function, it’s set to the PlatformName.
  3. It can be configured through the Unreal Engine editor as a UPROPERTY with the config specifier.

This variable interacts with other input-related variables, such as bSupportsGamepad, bCanChangeGamepadType, and ControllerData. It’s often used in conjunction with these variables to determine input behavior and UI representation.

Developers should be aware that:

  1. The value of DefaultGamepadName can vary depending on the platform and configuration.
  2. It’s used in functions that retrieve input-related UI elements, such as button prompts.
  3. Changing this value may affect how input is interpreted and displayed throughout the game.

Best practices when using this variable include:

  1. Ensure it’s set correctly for each supported platform.
  2. Use the GetDefaultGamepadName() function to retrieve its value rather than accessing it directly.
  3. Consider the implications of changing this value, especially if your game supports multiple gamepad types.
  4. Coordinate its usage with other input-related settings to maintain consistency in input handling and UI representation.

#Setting Variables

#References In INI files

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

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

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

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

Location: <Workspace>/Projects/Lyra/Config/Windows/WindowsGame.ini:6, 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:219

Scope (from outer to inner):

file
function     UCommonInputPlatformSettings::UCommonInputPlatformSettings

Source code excerpt:

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

void UCommonInputPlatformSettings::PostLoad()
{
	Super::PostLoad();

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

Scope (from outer to inner):

file
function     void UCommonInputPlatformSettings::InitializePlatformDefaults

Source code excerpt:

	bSupportsTouch = PlatformInfo.bSupportsTouch;

	DefaultGamepadName = PlatformName;
}

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

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

Scope (from outer to inner):

file
function     void UCommonInputSettings::PostInitProperties

Source code excerpt:

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

				Settings->TryUpdateDefaultConfigFile();
			}
			else if (PlatformData.Key == FCommonInputDefaults::PlatformPC)

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

Scope (from outer to inner):

file
function     void UCommonInputSettings::PostInitProperties

Source code excerpt:

						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:235

Scope (from outer to inner):

file
class        class UCommonInputPlatformSettings : public UPlatformSettings
function     const FName GetDefaultGamepadName

Source code excerpt:

	const FName GetDefaultGamepadName() const
	{
		return DefaultGamepadName;
	}

	bool CanChangeGamepadType() const 
	{
		return bCanChangeGamepadType;
	}

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

Scope (from outer to inner):

file
class        class UCommonInputPlatformSettings : public UPlatformSettings

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = "Default", Meta = (EditCondition = "bSupportsGamepad"))
	FName DefaultGamepadName;

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

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

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

Scope (from outer to inner):

file
function     FCommonInputPlatformBaseData

Source code excerpt:

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

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

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

Scope (from outer to inner):

file
function     const FName GetDefaultGamepadName

Source code excerpt:

	const FName GetDefaultGamepadName() const
	{
		return DefaultGamepadName;
	};

	bool CanChangeGamepadType() const 
	{
		return bCanChangeGamepadType;
	}

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

Scope: file

Source code excerpt:


	UPROPERTY(EditDefaultsOnly, Category = "Gamepad", Meta = (EditCondition = "bSupportsGamepad"))
	FName DefaultGamepadName;

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

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