bSupportsTouch

bSupportsTouch

#Overview

name: bSupportsTouch

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 bSupportsTouch is to indicate whether a platform supports touch input in Unreal Engine 5. This setting variable is primarily used for input handling and user interface considerations across different platforms.

Based on the callsites, this variable is mainly used in the CommonUI plugin, specifically in the CommonInput module. It’s also referenced in the Core module of Unreal Engine.

The value of this variable is typically set in platform-specific settings. It’s initialized in the UCommonInputPlatformSettings constructor and can be modified through configuration files or programmatically.

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

Developers should be aware that:

  1. This variable affects how input is handled and how user interfaces are presented.
  2. It’s platform-specific, so its value may change depending on the target platform.
  3. Changing this value may require adjusting other parts of the input system and UI to ensure proper functionality.

Best practices when using this variable include:

  1. Ensure it’s correctly set for each target platform in your project.
  2. Use it in conjunction with other input type checks to provide a comprehensive input strategy.
  3. Consider how changes to this variable might affect the user experience across different platforms.
  4. Use it to conditionally enable or disable touch-specific features or UI elements.
  5. Regularly test your game on touch-enabled devices when this variable is set to true to ensure proper functionality.

#Setting Variables

#References In INI files

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

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

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

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

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

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

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

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

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

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

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

Scope (from outer to inner):

file
function     UCommonInputPlatformSettings::UCommonInputPlatformSettings

Source code excerpt:

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

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

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

Scope (from outer to inner):

file
function     void UCommonInputPlatformSettings::InitializePlatformDefaults

Source code excerpt:

	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/CommonInputBaseTypes.cpp:368

Scope (from outer to inner):

file
function     bool UCommonInputPlatformSettings::SupportsInputType

Source code excerpt:

	case ECommonInputType::Touch:
	{
		return bSupportsTouch;
	}
	break;
	}
	return false;
}

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

Scope (from outer to inner):

file
function     void UCommonInputSettings::PostInitProperties

Source code excerpt:

				Settings->bSupportsMouseAndKeyboard = OriginalData.bSupportsMouseAndKeyboard;
				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:213

Scope (from outer to inner):

file
function     void UCommonInputSettings::PostInitProperties

Source code excerpt:

						PCPlatform->bSupportsMouseAndKeyboard = OriginalData.bSupportsMouseAndKeyboard;
						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:264

Scope (from outer to inner):

file
class        class UCommonInputPlatformSettings : public UPlatformSettings

Source code excerpt:


	UPROPERTY(config, EditAnywhere, Category = "Default")
	bool bSupportsTouch;

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

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

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

Scope (from outer to inner):

file
function     FCommonInputPlatformBaseData

Source code excerpt:

		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;
	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:327

Scope (from outer to inner):

file
function     bool SupportsInputType

Source code excerpt:

		case ECommonInputType::Touch:
		{
			return bSupportsTouch;
		}
		break;
		}
		return false;
	}

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

Scope: file

Source code excerpt:


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

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

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

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

Scope (from outer to inner):

file
function     static void LoadDDPIIniSettings

Source code excerpt:

	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

	DDPIGetString(IniFile, TEXT("AutoSDKPath"), Info.AutoSDKPath);

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

Scope: file

Source code excerpt:

	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) */
	FName OverrideCookPlatformName;