bEnableGestureRecognizer
bEnableGestureRecognizer
#Overview
name: bEnableGestureRecognizer
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bEnableGestureRecognizer is to enable or disable the gesture recognition system in Unreal Engine 5. This setting is primarily used for mobile input handling, allowing the engine to convert touch inputs into recognizable gestures that can be bound and queried within the game.
This setting variable is mainly relied upon by the Enhanced Input plugin and the core Engine module, particularly in areas related to input handling and Blueprint functionality.
The value of this variable is set in the InputSettings class, which is part of the Engine’s core configuration. It can be modified through the project settings in the Unreal Editor, specifically under the “Mobile” category of the Input settings.
The bEnableGestureRecognizer variable interacts with the GestureRecognizer system, influencing how touch inputs are processed and converted into gestures. It also affects the availability of certain Blueprint nodes related to input handling, as seen in the K2Node_InputDebugKey and K2Node_InputKey classes.
Developers must be aware that enabling or disabling this setting will impact the input behavior on mobile devices. When enabled, it adds an additional layer of input processing, which may affect performance but provides more sophisticated touch input capabilities.
Best practices when using this variable include:
- Only enable it when gesture recognition is necessary for your project, especially on mobile platforms.
- Be mindful of the performance impact, particularly on lower-end mobile devices.
- When enabled, ensure that your game’s input system is designed to handle both raw touch inputs and recognized gestures.
- Test thoroughly on target mobile devices to ensure smooth input handling and performance.
- Consider the implications on Blueprint nodes and input-related functionality when changing this setting, as it may affect existing input logic in your project.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseInput.ini:15, section: [/Script/Engine.InputSettings]
- INI Section:
/Script/Engine.InputSettings
- Raw value:
false
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/EnhancedInput/Source/InputBlueprintNodes/Private/K2Node_InputDebugKey.cpp:370
Scope (from outer to inner):
file
function void UK2Node_InputDebugKey::GetMenuActions
Source code excerpt:
UClass* ActionKey = GetClass();
const bool bAllowGestures = GetDefault<UInputSettings>()->bEnableGestureRecognizer;
// to keep from needlessly instantiating a UBlueprintNodeSpawner (and
// iterating over keys), first check to make sure that the registrar is
// looking for actions of this type (could be regenerating actions for a
// specific asset, and therefore the registrar would only accept actions
// corresponding to that asset)
#Loc: <Workspace>/Engine/Source/Editor/BlueprintGraph/Private/K2Node_InputKey.cpp:386
Scope (from outer to inner):
file
function void UK2Node_InputKey::GetMenuActions
Source code excerpt:
UClass* ActionKey = GetClass();
const bool bAllowGestures = GetDefault<UInputSettings>()->bEnableGestureRecognizer;
// to keep from needlessly instantiating a UBlueprintNodeSpawner (and
// iterating over keys), first check to make sure that the registrar is
// looking for actions of this type (could be regenerating actions for a
// specific asset, and therefore the registrar would only accept actions
// corresponding to that asset)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/Editor.h:328
Scope: file
Source code excerpt:
/** Called when the user requests objects to be force deleted. There is no possibility to cancel once this callback is made */
static UNREALED_API FOnPreForceDeleteObjects OnPreForceDeleteObjects;
/** Called when a user changes the UInputSettings::bEnableGestureRecognizer setting to refresh the available actions. */
static UNREALED_API FSimpleMulticastDelegate OnEnableGestureRecognizerChanged;
/** Called when Action or Axis mappings have been changed */
static UNREALED_API FSimpleMulticastDelegate OnActionAxisMappingsChanged;
/** Called from FEditorUtils::AddLevelToWorld after the level is added successfully to the world. */
static UNREALED_API FOnAddLevelToWorld OnAddLevelToWorld;
/** Sent before edit cut is handled */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/InputSettings.h:114
Scope (from outer to inner):
file
class class UInputSettings : public UObject
Source code excerpt:
/** Whether or not to use the gesture recognition system to convert touches in to gestures that can be bound and queried */
UPROPERTY(config, EditAnywhere, Category = "Mobile")
uint8 bEnableGestureRecognizer:1;
/** If enabled, virtual keyboards will have autocorrect enabled. Currently only supported on mobile devices. */
UPROPERTY(config, EditAnywhere, Category = "Virtual Keyboard (Mobile)")
uint8 bUseAutocorrect:1;
/**
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/InputSettings.cpp:203
Scope (from outer to inner):
file
function void UInputSettings::PostEditChangeChainProperty
Source code excerpt:
FEditorDelegates::OnActionAxisMappingsChanged.Broadcast();
}
else if (MemberPropertyName == GET_MEMBER_NAME_CHECKED(UInputSettings, bEnableGestureRecognizer))
{
FEditorDelegates::OnEnableGestureRecognizerChanged.Broadcast();
}
else if (MemberPropertyName == GET_MEMBER_NAME_CHECKED(UInputSettings, bEnableMotionControls))
{
FPlatformApplicationMisc::EnableMotionData(bEnableMotionControls);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/PlayerInput.cpp:2070
Scope (from outer to inner):
file
function void UPlayerInput::Tick
Source code excerpt:
ConditionalInitAxisProperties();
if (GetDefault<UInputSettings>()->bEnableGestureRecognizer)
{
SCOPE_CYCLE_COUNTER(STAT_PC_GestureRecognition);
GestureRecognizer.DetectGestures(Touches, this, DeltaTime);
}
}