EnhancedInput.Editor.EnableMappingNameValidation
EnhancedInput.Editor.EnableMappingNameValidation
#Overview
name: EnhancedInput.Editor.EnableMappingNameValidation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables editor validation on player mapping names
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of EnhancedInput.Editor.EnableMappingNameValidation is to control the validation of player mapping names in the Unreal Engine editor. This setting is specifically related to the Enhanced Input system, which is an improved input handling system in Unreal Engine.
This setting variable is primarily used by the Enhanced Input plugin, specifically within the Input Editor module. Based on the callsites, it’s clear that this variable is part of the editor functionality rather than runtime gameplay.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of true, but can be changed at runtime through the console or configuration files.
The associated variable bEnableMappingNameValidation directly interacts with EnhancedInput.Editor.EnableMappingNameValidation. They share the same value, with bEnableMappingNameValidation being the actual boolean variable used in the code logic.
Developers should be aware that when this setting is enabled (which it is by default), it adds an additional layer of validation for player mapping names. This validation checks if a mapping name is already in use, which can prevent naming conflicts and potential issues in input handling.
Best practices when using this variable include:
- Generally leaving it enabled to ensure proper validation of mapping names.
- Only disabling it if there’s a specific need to bypass the name validation, which should be done cautiously.
- Being aware that disabling this validation could lead to naming conflicts in player mappings, which might cause issues in input handling.
Regarding the associated variable bEnableMappingNameValidation:
The purpose of bEnableMappingNameValidation is to serve as the actual boolean flag used in the code to determine whether mapping name validation should be performed.
This variable is used within the Enhanced Input plugin, specifically in the Input Editor module. It’s checked in the FEnhancedInputPlayerMappableNameValidator::IsValid function to determine whether to perform additional validation.
The value of this variable is set by the EnhancedInput.Editor.EnableMappingNameValidation console variable.
This variable directly interacts with the console variable EnhancedInput.Editor.EnableMappingNameValidation, effectively implementing the behavior controlled by that setting.
Developers should be aware that this variable directly affects the behavior of the IsValid function in the FEnhancedInputPlayerMappableNameValidator class. When true, it adds an additional check to see if a mapping name is already in use.
Best practices for this variable are essentially the same as for the console variable it’s associated with, as they are directly linked and serve the same purpose within the Enhanced Input system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/EnhancedInput/Source/InputEditor/Private/EnhancedInputPlayerMappableNameValidator.cpp:12
Scope (from outer to inner):
file
namespace UE::EnhancedInput
Source code excerpt:
FAutoConsoleVariableRef CVarEnableMappingNameValidation(
TEXT("EnhancedInput.Editor.EnableMappingNameValidation"),
bEnableMappingNameValidation,
TEXT("Enables editor validation on player mapping names"),
ECVF_Default);
/**
* Returns the max acceptable length for a player mappable name.
#Associated Variable and Callsites
This variable is associated with another variable named bEnableMappingNameValidation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/EnhancedInput/Source/InputEditor/Private/EnhancedInputPlayerMappableNameValidator.cpp:9
Scope (from outer to inner):
file
namespace UE::EnhancedInput
Source code excerpt:
{
/** Enables editor validation on player mapping names */
static bool bEnableMappingNameValidation = true;
FAutoConsoleVariableRef CVarEnableMappingNameValidation(
TEXT("EnhancedInput.Editor.EnableMappingNameValidation"),
bEnableMappingNameValidation,
TEXT("Enables editor validation on player mapping names"),
ECVF_Default);
/**
* Returns the max acceptable length for a player mappable name.
*/
#Loc: <Workspace>/Engine/Plugins/EnhancedInput/Source/InputEditor/Private/EnhancedInputPlayerMappableNameValidator.cpp:41
Scope (from outer to inner):
file
function EValidatorResult FEnhancedInputPlayerMappableNameValidator::IsValid
Source code excerpt:
EValidatorResult Result = FStringSetNameValidator::IsValid(Name, bOriginal);
if (UE::EnhancedInput::bEnableMappingNameValidation &&
Result != EValidatorResult::ExistingName &&
FInputEditorModule::IsMappingNameInUse(FName(Name)))
{
Result = EValidatorResult::AlreadyInUse;
}