InputActions
InputActions
#Overview
name: InputActions
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 13
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of InputActions is to define and manage input actions for the game’s user interface and input system within Unreal Engine 5. This variable is primarily used in the context of the Common UI plugin and the Enhanced Input system.
InputActions is utilized by several Unreal Engine subsystems and modules, including:
- The Common UI plugin (CommonUI)
- The Enhanced Input system
- The Input Editor module
The value of this variable is typically set in the following ways:
- Through the UCommonUIInputSettings class, where it’s defined as a config variable.
- In UCommonActionWidget, where it can be set programmatically or through the editor.
- Via the Input Editor when creating or modifying Input Action assets.
InputActions often interacts with other variables and systems, such as:
- EnhancedInputAction in the Common UI plugin
- UInputAction class from the Enhanced Input system
- FCommonInputActionDataBase for legacy input systems
Developers should be aware of the following when using this variable:
- The InputActions array can contain multiple input actions, allowing for complex input mappings.
- It’s used in conjunction with the Enhanced Input system when enabled, but also supports legacy input systems.
- The Common UI plugin uses this variable to generate appropriate UI elements for displaying input actions.
Best practices when using InputActions include:
- Use the Enhanced Input system when possible, as it provides more flexibility and power.
- Keep the InputActions array organized and avoid duplicates.
- Use the Input Editor to create and manage Input Action assets for a more visual and user-friendly approach.
- When working with UCommonActionWidget, ensure that InputActions are properly set and updated to reflect the current input state.
- Consider using action overrides (ActionOverrides in UCommonUIInputSettings) for project-specific customizations without modifying the base InputActions.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultInput.ini:39, section: [/Script/CommonUI.CommonUIInputSettings]
- INI Section:
/Script/CommonUI.CommonUIInputSettings
- Raw value:
(ActionTag=UI.Action.Escape,DefaultDisplayName=NSLOCTEXT("[/Script/CommonUI]", "DDDC55F044A6D009AE3FC89634A4FBE3", "Back"),KeyMappings=((Key=Escape),(Key=Gamepad_Special_Right)))
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/EnhancedInput/Source/InputEditor/Private/InputEditorModule.cpp:262
Scope (from outer to inner):
file
function void FAssetTypeActions_InputAction::GetActions
Source code excerpt:
void FAssetTypeActions_InputAction::GetActions(const TArray<UObject*>& InObjects, FToolMenuSection& Section)
{
TArray<TWeakObjectPtr<UInputAction>> InputActions = GetTypedWeakObjectPtrs<UInputAction>(InObjects);
Section.AddMenuEntry(
"InputAction_CreateContextFromSelection",
LOCTEXT("InputAction_CreateContextFromSelection", "Create an Input Mapping Context"),
LOCTEXT("InputAction_CreateContextFromSelectionTooltip", "Create an Input Mapping Context that is filled with the selected Input Actions"),
FSlateIcon(FAppStyle::GetAppStyleSetName(), "ClassIcon.InputMappingContext"),
FUIAction(FExecuteAction::CreateSP(this, &FAssetTypeActions_InputAction::GetCreateContextFromActionsMenu, InputActions))
);
}
void FAssetTypeActions_InputAction::GetCreateContextFromActionsMenu(TArray<TWeakObjectPtr<UInputAction>> InActions)
{
if (InActions.IsEmpty())
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonActionWidget.cpp:33
Scope (from outer to inner):
file
function void UCommonActionWidget::Serialize
Source code excerpt:
if (!InputActionDataRow_DEPRECATED.IsNull())
{
InputActions.Add(InputActionDataRow_DEPRECATED);
InputActionDataRow_DEPRECATED = FDataTableRowHandle();
}
}
#endif
}
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonActionWidget.cpp:119
Scope (from outer to inner):
file
function FSlateBrush UCommonActionWidget::GetIcon
Source code excerpt:
return EnhancedInputAction && CommonUI::IsEnhancedInputSupportEnabled()
? CommonUI::GetIconForEnhancedInputAction(CommonInputSubsystem, EnhancedInputAction)
: CommonUI::GetIconForInputActions(CommonInputSubsystem, InputActions);
}
}
#if WITH_EDITORONLY_DATA
else
{
if (DesignTimeKey.IsValid())
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonActionWidget.cpp:164
Scope (from outer to inner):
file
function const FCommonInputActionDataBase* UCommonActionWidget::GetInputActionData
Source code excerpt:
const FCommonInputActionDataBase* UCommonActionWidget::GetInputActionData() const
{
if (InputActions.Num() > 0)
{
const FCommonInputActionDataBase* InputActionData = CommonUI::GetInputActionData(InputActions[0]);
return InputActionData;
}
return nullptr;
}
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonActionWidget.cpp:236
Scope (from outer to inner):
file
function void UCommonActionWidget::SetInputAction
Source code excerpt:
UpdateBindingHandleInternal(FUIActionBindingHandle());
InputActions.Reset();
InputActions.Add(InputActionRow);
UpdateActionWidget();
}
void UCommonActionWidget::SetInputActionBinding(FUIActionBindingHandle BindingHandle)
{
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonActionWidget.cpp:255
Scope (from outer to inner):
file
function void UCommonActionWidget::SetInputActionBinding
Source code excerpt:
}
InputActions.Reset();
InputActions.Add(Binding->LegacyActionTableRow);
UpdateActionWidget();
}
}
void UCommonActionWidget::SetInputActions(TArray<FDataTableRowHandle> InInputActions)
{
UpdateBindingHandleInternal(FUIActionBindingHandle());
InputActions = InInputActions;
UpdateActionWidget();
}
void UCommonActionWidget::SetIconRimBrush(FSlateBrush InIconRimBrush)
{
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonUITypes.cpp:219
Scope (from outer to inner):
file
function FSlateBrush CommonUI::GetIconForInputActions
Source code excerpt:
}
FSlateBrush CommonUI::GetIconForInputActions(const UCommonInputSubsystem* CommonInputSubsystem, const TArray<FDataTableRowHandle>& InputActions)
{
TArray<FKey> Keys;
for (const FDataTableRowHandle& InputAction : InputActions)
{
if (const FCommonInputActionDataBase* InputActionData = GetInputActionData(InputAction))
{
const FCommonInputTypeInfo& TypeInfo = InputActionData->GetCurrentInputTypeInfo(CommonInputSubsystem);
Keys.Add(TypeInfo.GetKey());
}
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/Input/CommonBoundActionBar.cpp:279
Scope (from outer to inner):
file
function void UCommonBoundActionBar::HandleDeferredDisplayUpdate
lambda-function
Source code excerpt:
const UInputAction* InputActionB = nullptr;
// InputActions will be null unless IsEnhancedInputSupportEnabled, so we don't have to check for support below
if (CommonUI::IsEnhancedInputSupportEnabled())
{
InputActionA = BindingA->InputAction.Get();
InputActionB = BindingB->InputAction.Get();
}
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/Input/CommonUIInputSettings.cpp:17
Scope (from outer to inner):
file
function const FUIInputAction* UCommonUIInputSettings::FindAction
Source code excerpt:
const FUIInputAction* UCommonUIInputSettings::FindAction(FUIActionTag ActionTag) const
{
return InputActions.FindByPredicate([ActionTag](const FUIInputAction& Action) { return Action.ActionTag == ActionTag; });
}
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Public/CommonActionWidget.h:93
Scope (from outer to inner):
file
class class UCommonActionWidget: public UWidget
Source code excerpt:
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = CommonActionWidget, meta = (RowType = "/Script/CommonUI.CommonInputActionDataBase", TitleProperty = "RowName"))
TArray<FDataTableRowHandle> InputActions;
/**
* Input Action this common action widget is intended to represent. Optional if using EnhancedInputs
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = CommonActionWidget, meta = (EditCondition = "CommonInput.CommonInputSettings.IsEnhancedInputSupportEnabled", EditConditionHides))
TObjectPtr<class UInputAction> EnhancedInputAction;
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Public/CommonUITypes.h:279
Scope (from outer to inner):
file
class class CommonUI
Source code excerpt:
static const FCommonInputActionDataBase* GetInputActionData(const FDataTableRowHandle& InputActionRowHandle);
static FSlateBrush GetIconForInputActions(const UCommonInputSubsystem* CommonInputSubsystem, const TArray<FDataTableRowHandle>& InputActions);
static bool IsEnhancedInputSupportEnabled();
static TObjectPtr<const UCommonInputMetadata> GetEnhancedInputActionMetadata(const UInputAction* InputAction);
static void GetEnhancedInputActionKeys(const ULocalPlayer* LocalPlayer, const UInputAction* InputAction, TArray<FKey>& OutKeys);
static void InjectEnhancedInputForAction(const ULocalPlayer* LocalPlayer, const UInputAction* InputAction, FInputActionValue RawValue);
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Public/Input/CommonUIInputSettings.h:108
Scope (from outer to inner):
file
class class UCommonUIInputSettings : public UObject
function const TArray<FUIInputAction>& GetUIInputActions
Source code excerpt:
int32 GetUIActionProcessingPriority() const { return UIActionProcessingPriority; }
COMMONUI_API const FUIInputAction* FindAction(FUIActionTag ActionTag) const;
COMMONUI_API const TArray<FUIInputAction>& GetUIInputActions() const { return InputActions; }
const FCommonAnalogCursorSettings& GetAnalogCursorSettings() const { return AnalogCursorSettings; }
//
private:
/** True to have the mouse pointer automatically moved to the center of whatever widget is currently focused while using a gamepad. */
UPROPERTY(EditAnywhere, Config, Category = General)
bool bLinkCursorToGamepadFocus = true;
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Public/Input/CommonUIInputSettings.h:131
Scope (from outer to inner):
file
class class UCommonUIInputSettings : public UObject
Source code excerpt:
/** All UI input action mappings for the project */
UPROPERTY(EditAnywhere, Config, Category = Actions, meta = (TitleProperty = "ActionTag"))
TArray<FUIInputAction> InputActions;
/** Config-only set of input action overrides - if an entry for a given action is both here and in the InputActions array, this entry wins completely. */
UPROPERTY(Config)
TArray<FUIInputAction> ActionOverrides;
UPROPERTY(EditAnywhere, Config, Category = AnalogCursor)
FCommonAnalogCursorSettings AnalogCursorSettings;
};