Search.TryIndexAssetsOnLoad

Search.TryIndexAssetsOnLoad

#Overview

name: Search.TryIndexAssetsOnLoad

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Search.TryIndexAssetsOnLoad is to control whether assets should be indexed when they are loaded in the Unreal Engine editor. This setting is part of the asset search system, which is used to improve asset discoverability and management within the engine.

This setting variable is primarily used in the AssetSearch plugin, which is part of the Unreal Engine editor tools. The plugin is responsible for indexing and searching assets within the project.

The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be changed at runtime through the console or configuration files. By default, it is set to false.

The associated variable bTryIndexAssetsOnLoad directly interacts with Search.TryIndexAssetsOnLoad. They share the same value, and bTryIndexAssetsOnLoad is used in the C++ code to control the behavior of asset indexing.

Developers should be aware of the following when using this variable:

  1. Enabling this option may impact performance during asset loading, as it will attempt to index assets as they are loaded.
  2. It affects the behavior of the OnAssetLoaded function in the AssetSearchManager class.
  3. It can influence the ForceIndexOnAssetsMissingIndex function, potentially changing how missing indices are handled.

Best practices when using this variable include:

  1. Consider enabling it in development environments to ensure all assets are indexed, but disable it in production to optimize loading times.
  2. Monitor performance impact when enabled, especially in projects with many assets.
  3. Use in conjunction with other asset search settings to fine-tune the indexing behavior.

Regarding the associated variable bTryIndexAssetsOnLoad:

The purpose of bTryIndexAssetsOnLoad is to serve as the internal flag that controls the asset indexing behavior within the AssetSearchManager class.

This variable is used directly in the C++ code of the AssetSearch plugin, specifically in the AssetSearchManager class.

The value of bTryIndexAssetsOnLoad is set by the Search.TryIndexAssetsOnLoad console variable.

It interacts closely with the Search.TryIndexAssetsOnLoad setting and is used in conditional statements to determine whether to index assets on load.

Developers should be aware that changes to Search.TryIndexAssetsOnLoad will directly affect the behavior controlled by bTryIndexAssetsOnLoad.

Best practices for using bTryIndexAssetsOnLoad include:

  1. Avoid modifying this variable directly in code; instead, use the Search.TryIndexAssetsOnLoad console variable to control its value.
  2. When debugging asset indexing issues, check the value of this variable to understand the current indexing behavior.
  3. Consider the performance implications of enabling this flag, especially in large projects with many assets.

#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:57

Scope: file

Source code excerpt:

static bool bTryIndexAssetsOnLoad = false;
FAutoConsoleVariableRef CVarTryIndexAssetsOnLoad(
	TEXT("Search.TryIndexAssetsOnLoad"),
	bTryIndexAssetsOnLoad,
	TEXT("Tries to index assets on load.")
);

static bool bTryToGCDuringMissingIndexing = false;
FAutoConsoleVariableRef CVarTryToGCDuringMissingIndexing(

#Associated Variable and Callsites

This variable is associated with another variable named bTryIndexAssetsOnLoad. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:55

Scope: file

Source code excerpt:

);

static bool bTryIndexAssetsOnLoad = false;
FAutoConsoleVariableRef CVarTryIndexAssetsOnLoad(
	TEXT("Search.TryIndexAssetsOnLoad"),
	bTryIndexAssetsOnLoad,
	TEXT("Tries to index assets on load.")
);

static bool bTryToGCDuringMissingIndexing = false;
FAutoConsoleVariableRef CVarTryToGCDuringMissingIndexing(
	TEXT("Search.TryToGCDuringMissingIndexing"),

#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:551

Scope (from outer to inner):

file
function     void FAssetSearchManager::OnAssetLoaded

Source code excerpt:

	check(IsInGameThread());

	if (bTryIndexAssetsOnLoad)
	{
		switch (IntermediateStorage)
		{
			case ESearchIntermediateStorage::DerivedDataCache:
				RequestIndexAsset_DDC(InObject);
				break;

#Loc: <Workspace>/Engine/Plugins/Editor/AssetSearch/Source/Private/AssetSearchManager.cpp:1114

Scope (from outer to inner):

file
function     void FAssetSearchManager::ForceIndexOnAssetsMissingIndex

Source code excerpt:

				}

				if (!bTryIndexAssetsOnLoad)
				{
					StoreIndexForAsset(AssetToIndex);
				}
			}

			if (UnloadScope.GetObjectsLoaded() > 2000)