r.UseFastDebugObjectDiscovery

r.UseFastDebugObjectDiscovery

#Overview

name: r.UseFastDebugObjectDiscovery

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 r.UseFastDebugObjectDiscovery is to enable an optimized method for discovering debug objects in the Unreal Engine editor, specifically within the Blueprint editor.

This setting variable is primarily used by the Kismet module, which is part of the Unreal Engine editor subsystem. It affects the Blueprint editor’s functionality, particularly in how it discovers and displays debug objects.

The value of this variable is set using a console variable (CVar) named CVarUseFastDebugObjectDiscovery. It is initialized with a default value of 1, meaning the fast debug object discovery is enabled by default.

The associated variable CVarUseFastDebugObjectDiscovery directly interacts with r.UseFastDebugObjectDiscovery. They share the same value and purpose.

Developers must be aware that this variable affects the performance and behavior of debug object discovery in the Blueprint editor. When enabled (set to 1), it uses an optimized path for finding debug objects, which could potentially improve performance in large projects with many debug objects.

Best practices when using this variable include:

  1. Leaving it enabled (value 1) for better performance in most cases.
  2. If experiencing issues with debug object discovery, developers can try disabling it (setting to 0) to see if it resolves the problem.
  3. When profiling or debugging the Blueprint editor’s performance, consider testing with both enabled and disabled states to understand its impact.

Regarding the associated variable CVarUseFastDebugObjectDiscovery:

The purpose of CVarUseFastDebugObjectDiscovery is to provide a programmatic way to access and modify the r.UseFastDebugObjectDiscovery setting within C++ code.

It is used in the Kismet module of the Unreal Engine editor, specifically within the Blueprint editor implementation.

The value of CVarUseFastDebugObjectDiscovery is set when it’s declared, mirroring the value of r.UseFastDebugObjectDiscovery. It can be accessed and potentially modified at runtime using Unreal Engine’s console variable system.

This variable directly interacts with r.UseFastDebugObjectDiscovery, effectively serving as its C++ representation.

Developers should be aware that changes to CVarUseFastDebugObjectDiscovery will affect the behavior of debug object discovery in the Blueprint editor. It’s used in the GenerateDebugObjectInstances function to determine which path to take for object discovery.

Best practices for using CVarUseFastDebugObjectDiscovery include:

  1. Using GetValueOnGameThread() to safely access its value in game thread code.
  2. Avoiding frequent changes to this variable during runtime, as it could impact performance or cause inconsistent behavior in the Blueprint editor.
  3. If modifying this variable programmatically, ensure to update any related systems or UI that might depend on the current debug object discovery method.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/SBlueprintEditorSelectedDebugObjectWidget.cpp:50

Scope: file

Source code excerpt:

#define LOCTEXT_NAMESPACE "KismetToolbar"

static TAutoConsoleVariable<int32> CVarUseFastDebugObjectDiscovery(TEXT("r.UseFastDebugObjectDiscovery"), 1, TEXT("Enable new optimised debug object discovery"));

//////////////////////////////////////////////////////////////////////////
// SBlueprintEditorSelectedDebugObjectWidget

void SBlueprintEditorSelectedDebugObjectWidget::Construct(const FArguments& InArgs, TSharedPtr<FBlueprintEditor> InBlueprintEditor)
{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/SBlueprintEditorSelectedDebugObjectWidget.cpp:50

Scope: file

Source code excerpt:

#define LOCTEXT_NAMESPACE "KismetToolbar"

static TAutoConsoleVariable<int32> CVarUseFastDebugObjectDiscovery(TEXT("r.UseFastDebugObjectDiscovery"), 1, TEXT("Enable new optimised debug object discovery"));

//////////////////////////////////////////////////////////////////////////
// SBlueprintEditorSelectedDebugObjectWidget

void SBlueprintEditorSelectedDebugObjectWidget::Construct(const FArguments& InArgs, TSharedPtr<FBlueprintEditor> InBlueprintEditor)
{

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/SBlueprintEditorSelectedDebugObjectWidget.cpp:347

Scope (from outer to inner):

file
function     void SBlueprintEditorSelectedDebugObjectWidget::GenerateDebugObjectInstances

Source code excerpt:

	if (!BlueprintEditor.Pin()->OnlyShowCustomDebugObjects())
	{
		const bool bModifiedIterator = CVarUseFastDebugObjectDiscovery.GetValueOnGameThread() == 1;
		UClass* BlueprintClass = GetBlueprintObj()->GeneratedClass;

		if (bModifiedIterator && BlueprintClass)
		{
			// Experimental new path for debug object discovery
			TArray<UObject*> BlueprintInstances;