ConsoleKeys
ConsoleKeys
#Overview
name: ConsoleKeys
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ConsoleKeys is to define the keys that can be used to open the in-game console in Unreal Engine. This setting variable is primarily used for the user interface and input handling system within the engine.
ConsoleKeys is primarily used by the Engine module, specifically within the input handling and console subsystems. The main components that rely on this setting are:
- The UInputSettings class, which manages input-related configurations.
- The UConsole class, which handles the in-game console functionality.
The value of this variable is set in the engine configuration files and can be modified through the UInputSettings class. It is stored as a TArray
ConsoleKeys interacts with other input-related variables and systems, particularly those handling key events and modifier keys (Alt, Shift, Ctrl, etc.).
Developers should be aware of the following when using this variable:
- It supports multiple keys, allowing for flexibility in console activation.
- The engine automatically adds international console keys based on the system’s keyboard layout.
- Modifier keys (Alt, Shift, Ctrl, Command) are considered when determining if the console should be opened.
Best practices for using ConsoleKeys include:
- Ensure that the chosen keys do not conflict with other important game inputs.
- Consider adding multiple keys to accommodate different keyboard layouts and player preferences.
- Use the UInputSettings class to modify these keys programmatically if needed.
- Be aware of the automatic international key additions to avoid unintended console activation.
- Test the console activation on different keyboard layouts to ensure compatibility.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseInput.ini:16, section: [/Script/Engine.InputSettings]
- INI Section:
/Script/Engine.InputSettings
- Raw value:
Tilde
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/InputSettings.h:183
Scope (from outer to inner):
file
class class UInputSettings : public UObject
Source code excerpt:
/** The keys which open the console. */
UPROPERTY(config, EditAnywhere, Category="Console")
TArray<FKey> ConsoleKeys;
// UObject interface
#if WITH_EDITOR
ENGINE_API virtual void PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent) override;
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:841
Scope (from outer to inner):
file
function bool UConsole::InputKey_InputLine
Source code excerpt:
FModifierKeysState KeyState = FSlateApplication::Get().GetModifierKeys();
bModifierDown |= KeyState.IsAltDown() || KeyState.IsCommandDown() || KeyState.IsShiftDown() || KeyState.IsControlDown();
if (GetDefault<UInputSettings>()->ConsoleKeys.Contains(Key) && Event == IE_Pressed && !bModifierDown)
{
if (ConsoleState == NAME_Typing)
{
FakeGotoState(NAME_Open);
bCaptureKeyInput = true;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/InputSettings.cpp:139
Scope (from outer to inner):
file
function void UInputSettings::AddInternationalConsoleKey
Source code excerpt:
// If the console key is set to the default we'll see about adding the keyboard default
// If they've mapped any additional keys, we'll just assume they've set it up in a way they desire
if (ConsoleKeys.Num() == 1 && ConsoleKeys[0] == EKeys::Tilde)
{
FKey DefaultConsoleKey = EKeys::Tilde;
switch (PRIMARYLANGID(LOWORD(GetKeyboardLayout(0))))
{
case LANG_FRENCH:
case LANG_HUNGARIAN:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/InputSettings.cpp:174
Scope (from outer to inner):
file
function void UInputSettings::AddInternationalConsoleKey
Source code excerpt:
if (DefaultConsoleKey != EKeys::Tilde && DefaultConsoleKey.IsValid())
{
ConsoleKeys.Add(DefaultConsoleKey);
}
}
#endif
}
void UInputSettings::PostReloadConfig(FProperty* PropertyThatWasLoaded)