DoubleClickTime
DoubleClickTime
#Overview
name: DoubleClickTime
The value of this variable can be defined or overridden in .ini config files. 3
.ini config files referencing this setting variable.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of DoubleClickTime is to define the maximum time interval between two clicks or touches that will be recognized as a double-click event in Unreal Engine 5. This setting is crucial for input handling and user interaction in both the game runtime and the editor environment.
This setting variable is used by multiple Unreal Engine subsystems and modules:
- VR Editor: The VREditorUISystem uses it to detect double-click events in the VR editing environment.
- Input System: The PlayerInput class uses it to determine if consecutive key presses or touch inputs should be treated as double-clicks.
- Input Settings: It’s defined as a configurable property in the InputSettings class.
The value of this variable is set in the project’s configuration files and can be modified through the UVRModeSettings and UInputSettings classes. It can be accessed using GetDefault
This variable interacts with other input-related variables and systems, such as KeyState and EventAccumulator, which are used to track input events and their timing.
Developers should be aware of the following when using this variable:
- It affects both mouse/keyboard and touch input detection.
- The value is in seconds and should be kept relatively small (typically between 0.1 and 0.5 seconds).
- It’s used in both the game runtime and the VR editor, so changes may affect both environments.
Best practices when using this variable include:
- Adjust it carefully to balance responsiveness and usability for your specific game or application.
- Consider providing a user-configurable option for this setting, as some players may prefer different double-click speeds.
- Test thoroughly across different input devices (mouse, touch, VR controllers) to ensure consistent behavior.
- Be aware that very low values may make double-clicks difficult for some users, while very high values may introduce input lag or unintended double-clicks.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorSettings.ini:62, section: [/Script/VREditor.VRModeSettings]
- INI Section:
/Script/VREditor.VRModeSettings
- Raw value:
0.250000
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseInput.ini:8, section: [/Script/Engine.InputSettings]
- INI Section:
/Script/Engine.InputSettings
- Raw value:
0.2f
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/DefaultInput.ini:30, section: [/Script/Engine.InputSettings]
- INI Section:
/Script/Engine.InputSettings
- Raw value:
0.200000
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VREditorUISystem.cpp:489
Scope: file
Source code excerpt:
{
const double CurrentTime = FPlatformTime::Seconds();
if (CurrentTime - VREditorInteractor->GetLastUIPressTime() <= GetDefault<UVRModeSettings>()->DoubleClickTime)
{
// Trigger a double click event!
Reply = FSlateApplication::Get().RoutePointerDoubleClickEvent(WidgetPathUnderFinger, PointerEvent);
}
else
{
#Loc: <Workspace>/Engine/Source/Editor/VREditor/Public/VRModeSettings.h:71
Scope (from outer to inner):
file
class class UVRModeSettings : public UVISettings
Source code excerpt:
/** The maximum time in seconds between two clicks for a double-click to register */
UPROPERTY(EditAnywhere, config, Category = "Motion Controllers", meta = (ClampMin = 0.01, ClampMax = 1.0))
float DoubleClickTime;
/** The amount (between 0-1) you have to depress the Vive controller trigger to register a press */
UPROPERTY(EditAnywhere, config, Category = "Motion Controllers", meta = (DisplayName = "Trigger Pressed Threshold (Vive)", ClampMin = 0.01, ClampMax = 1.0))
float TriggerPressedThreshold_Vive;
/** The amount (between 0-1) you have to depress the Oculus Touch controller trigger to register a press */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/InputSettings.h:153
Scope (from outer to inner):
file
class class UInputSettings : public UObject
Source code excerpt:
/** If a key is pressed twice in this amount of time it is considered a "double click" */
UPROPERTY(config, EditAnywhere, Category="MouseProperties", AdvancedDisplay)
float DoubleClickTime;
private:
/** List of Action Mappings */
UPROPERTY(config, EditAnywhere, Category="Bindings")
TArray<struct FInputActionKeyMapping> ActionMappings;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/PlayerInput.cpp:369
Scope (from outer to inner):
file
function bool UPlayerInput::InputKey
Source code excerpt:
// note, a tripleclick will currently count as a 2nd double click.
const float WorldRealTimeSeconds = World->GetRealTimeSeconds();
if ((WorldRealTimeSeconds - KeyState.LastUpDownTransitionTime) < GetDefault<UInputSettings>()->DoubleClickTime)
{
KeyState.EventAccumulator[IE_DoubleClick].Add(++EventCount);
}
// just went down
KeyState.LastUpDownTransitionTime = WorldRealTimeSeconds;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/PlayerInput.cpp:462
Scope (from outer to inner):
file
function bool UPlayerInput::InputTouch
Source code excerpt:
// note, a tripleclick will currently count as a 2nd double click.
const float WorldRealTimeSeconds = World->GetRealTimeSeconds();
if ((WorldRealTimeSeconds - KeyState.LastUpDownTransitionTime) < GetDefault<UInputSettings>()->DoubleClickTime)
{
KeyState.EventAccumulator[IE_DoubleClick].Add(++EventCount);
// store current touch location paired with event id
TouchEventLocations.Add(EventCount, Touches[Handle]);
}