console.searchmode.legacy
console.searchmode.legacy
#Overview
name: console.searchmode.legacy
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Use the legacy search behaviour for console commands \n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of console.searchmode.legacy
is to control the search behavior for console commands in Unreal Engine’s console interface. It determines whether the engine should use the legacy search behavior or a newer, potentially more advanced search method for autocomplete functionality.
This setting variable is primarily used by the Unreal Engine’s user interface subsystem, specifically the console module. It’s referenced in the Engine module, within the UserInterface component.
The value of this variable is set through the TAutoConsoleVariable declaration. It’s initialized with a default value of false
, meaning that by default, the legacy search mode is not used.
The console.searchmode.legacy
variable interacts directly with the CVarConsoleLegacySearch
variable. They share the same value, as CVarConsoleLegacySearch
is the C++ representation of the console variable.
Developers should be aware that changing this variable will affect the behavior of the console’s autocomplete functionality. When set to true, it will use the older, legacy search behavior for console commands.
Best practices when using this variable include:
- Only enable legacy search mode if there are specific compatibility issues with the newer search behavior.
- Document any changes to this variable in the project, as it affects the developer experience when using the console.
- Consider the performance implications of using legacy search, especially in projects with a large number of console commands.
Regarding the associated variable CVarConsoleLegacySearch
:
The purpose of CVarConsoleLegacySearch
is to provide a C++ accessible way to interact with the console.searchmode.legacy
console variable. It’s used within the engine’s C++ code to check the current state of the legacy search mode.
This variable is used in the Engine module, specifically in the console implementation of the user interface subsystem.
The value of CVarConsoleLegacySearch
is set through the TAutoConsoleVariable declaration, which links it to the console.searchmode.legacy
console variable.
CVarConsoleLegacySearch
interacts directly with the console input system, affecting how autocomplete suggestions are generated and displayed.
Developers should be aware that this variable is used in conditional statements to determine the search behavior. Changes to this variable will immediately affect the console’s functionality.
Best practices for using CVarConsoleLegacySearch
include:
- Use
GetValueOnAnyThread()
to safely access its value from any thread. - Avoid frequently changing this value during runtime, as it could lead to inconsistent user experience.
- If modifying the console search behavior, consider updating both the console variable and this C++ variable to maintain consistency.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:59
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarConsoleLegacySearch(
TEXT("console.searchmode.legacy"),
false,
TEXT("Use the legacy search behaviour for console commands \n"),
ECVF_Default);
namespace ConsoleDefs
#Associated Variable and Callsites
This variable is associated with another variable named CVarConsoleLegacySearch
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:58
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<bool> CVarConsoleLegacySearch(
TEXT("console.searchmode.legacy"),
false,
TEXT("Use the legacy search behaviour for console commands \n"),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/Console.cpp:493
Scope (from outer to inner):
file
function void UConsole::UpdateCompleteIndices
Source code excerpt:
AutoCompleteCursor = 0;
if (CVarConsoleLegacySearch.GetValueOnAnyThread())
{
// use the old autocomplete behaviour
FAutoCompleteNode* Node = &AutoCompleteTree;
FString LowerTypedStr = TypedStr.ToLower();
int32 EndIdx = -1;
for (int32 Idx = 0; Idx < TypedStr.Len(); Idx++)