Editor.ObjectReverseLookupMode

Editor.ObjectReverseLookupMode

#Overview

name: Editor.ObjectReverseLookupMode

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Editor.ObjectReverseLookupMode is to control the behavior of reverse lookup tables for objects in the Unreal Engine editor. This setting variable is primarily used for performance optimization in the object management system.

This setting variable is relied upon by the Engine module, specifically within the object caching and lookup subsystem. Based on the code, it’s part of the ObjectCacheContext functionality.

The value of this variable is set through a console variable (CVar) system. It can be set via command-line arguments or through the console in the engine. The default value is 1, which maintains permanent reverse lookup tables for faster behavior.

The associated variable CVarObjectReverseLookupMode interacts directly with Editor.ObjectReverseLookupMode. They share the same value and purpose.

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

  1. It has three possible modes (0, 1, and 2), each with different performance implications.
  2. It’s marked as ECVF_ReadOnly, meaning it can only be set from the command-line and not changed at runtime.
  3. Changing this value can significantly impact performance, especially in projects with many objects.

Best practices when using this variable include:

  1. Use mode 1 (the default) for most development scenarios, as it offers the best balance of performance.
  2. Consider using mode 0 if memory usage is a concern and the slight performance hit is acceptable.
  3. Use mode 2 only for debugging or validation purposes, as it’s the slowest.
  4. Set this variable early in the launch process, preferably via command-line arguments, due to its read-only nature.

Regarding the associated variable CVarObjectReverseLookupMode:

Developers should interact with this setting primarily through the Editor.ObjectReverseLookupMode console command or command-line argument, rather than directly manipulating CVarObjectReverseLookupMode in code.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ObjectCacheContext.cpp:35

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarObjectReverseLookupMode(
	TEXT("Editor.ObjectReverseLookupMode"),
	1,
	TEXT("0 - Reverse lookup tables are computed every time they are needed (slower behavior) \n")
	TEXT("1 - Maintain permanent reverse lookup tables (faster behavior) \n")
	TEXT("2 - Comparison mode (slowest to do validation between both mode) \n"),
	ECVF_ReadOnly /* Can only be enabled from the command-line */
);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ObjectCacheContext.cpp:34

Scope: file

Source code excerpt:

#include "ObjectCacheEventSink.h"

static TAutoConsoleVariable<int32> CVarObjectReverseLookupMode(
	TEXT("Editor.ObjectReverseLookupMode"),
	1,
	TEXT("0 - Reverse lookup tables are computed every time they are needed (slower behavior) \n")
	TEXT("1 - Maintain permanent reverse lookup tables (faster behavior) \n")
	TEXT("2 - Comparison mode (slowest to do validation between both mode) \n"),
	ECVF_ReadOnly /* Can only be enabled from the command-line */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ObjectCacheContext.cpp:100

Scope (from outer to inner):

file
namespace    ObjectCacheContextImpl
function     EObjectReverseLookupMode GetObjectReverseLookupMode

Source code excerpt:

		if (FParse::Value(FCommandLine::Get(), TEXT("-ObjectReverseLookupMode="), Mode))
		{
			CVarObjectReverseLookupMode->Set(Mode, ECVF_SetByCommandline);
		}
		GIsGetObjectReverseLookupModeInitialized = true;
	}

	return (EObjectReverseLookupMode)CVarObjectReverseLookupMode.GetValueOnAnyThread();
}

static bool GIsGetObjectReverseLookupMaskInitialized = false;
EObjectReverseLookupMask GetObjectReverseLookupMask()
{
	if (!GIsGetObjectReverseLookupMaskInitialized)