Search.ForceEnable
Search.ForceEnable
#Overview
name: Search.ForceEnable
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable universal search
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Search.ForceEnable is to control the universal search functionality in the Unreal Engine editor’s Asset Search system. It is designed to forcibly enable the universal search feature, overriding other settings or conditions that might otherwise disable it.
This setting variable is primarily used within the Asset Search plugin, which is part of the Unreal Engine editor’s functionality. It is specifically utilized in the AssetSearchManager module, which manages the indexing and searching of assets within the editor.
The value of this variable is set through an FAutoConsoleVariableRef, which means it can be modified at runtime via console commands. This allows developers to toggle the force enable feature without recompiling the engine.
Search.ForceEnable interacts directly with the associated boolean variable bForceEnableSearch. They share the same value, with bForceEnableSearch being used in the actual code logic to control the search behavior.
Developers should be aware that enabling this variable will override other settings and force the universal search to be active. This could potentially impact performance, especially in projects with a large number of assets.
Best practices when using this variable include:
- Use it primarily for debugging or testing purposes.
- Be cautious about enabling it in production environments, as it may affect performance.
- Consider the impact on other team members when enabling it in shared development environments.
Regarding the associated variable bForceEnableSearch:
The purpose of bForceEnableSearch is to serve as the internal boolean flag that the code checks to determine if the universal search should be forcibly enabled.
It is used within the AssetSearchManager to control the behavior of the asset scanning and indexing processes. When true, it ensures that the asset scanning is always active, regardless of other settings.
The value of bForceEnableSearch is set by the Search.ForceEnable console variable.
This variable interacts with other parts of the AssetSearchManager, such as the UpdateScanningAssets and Tick_GameThread functions, where it influences the decision to start scanning assets and affects the performance settings used for asset scanning.
Developers should be aware that modifying bForceEnableSearch directly in the code is not recommended, as its value is controlled by the Search.ForceEnable console variable.
Best practices for bForceEnableSearch include:
- Avoid modifying it directly in code; instead, use the Search.ForceEnable console variable.
- Be aware of its impact on the asset scanning and indexing processes when debugging search-related issues.
- Consider its state when optimizing performance in the editor, especially for projects with large asset counts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:50
Scope: file
Source code excerpt:
static bool bForceEnableSearch = false;
FAutoConsoleVariableRef CVarDisableUniversalSearch(
TEXT("Search.ForceEnable"),
bForceEnableSearch,
TEXT("Enable universal search")
);
static bool bTryIndexAssetsOnLoad = false;
FAutoConsoleVariableRef CVarTryIndexAssetsOnLoad(
#Associated Variable and Callsites
This variable is associated with another variable named bForceEnableSearch
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:48
Scope: file
Source code excerpt:
#define LOCTEXT_NAMESPACE "FAssetSearchManager"
static bool bForceEnableSearch = false;
FAutoConsoleVariableRef CVarDisableUniversalSearch(
TEXT("Search.ForceEnable"),
bForceEnableSearch,
TEXT("Enable universal search")
);
static bool bTryIndexAssetsOnLoad = false;
FAutoConsoleVariableRef CVarTryIndexAssetsOnLoad(
TEXT("Search.TryIndexAssetsOnLoad"),
#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:255
Scope (from outer to inner):
file
function void FAssetSearchManager::UpdateScanningAssets
Source code excerpt:
}
if (bForceEnableSearch)
{
bTargetState = true;
}
if (bTargetState != bStarted)
{
#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:963
Scope (from outer to inner):
file
function bool FAssetSearchManager::Tick_GameThread
Source code excerpt:
const USearchUserSettings* UserSettings = GetDefault<USearchUserSettings>();
const FSearchPerformance& PerformanceLimits = bForceEnableSearch ? UserSettings->DefaultOptions : UserSettings->GetPerformanceOptions();
int32 ScanLimit = PerformanceLimits.AssetScanRate;
while (ProcessAssetQueue.Num() > 0 && ScanLimit > 0)
{
FAssetOperation Operation = ProcessAssetQueue.Pop(EAllowShrinking::No);
FAssetData Asset = Operation.Asset;