Insights.RecordAllWorldTypes

Insights.RecordAllWorldTypes

#Overview

name: Insights.RecordAllWorldTypes

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 Insights.RecordAllWorldTypes is to control the scope of world types recorded by the Gameplay Insights system in Unreal Engine 5. By default, it only records Game and PIE (Play In Editor) worlds, but when enabled, it allows for the recording of other world types as well.

This setting variable is primarily used by the Engine module, specifically within the TraceFilters system. It’s part of the Insights subsystem, which is responsible for gameplay data recording and analysis.

The value of this variable is set through a console variable (CVar) named CVarRecordAllWorldTypes. It’s initialized with a default value of 0, meaning by default, only Game and PIE worlds are recorded.

The associated variable CVarRecordAllWorldTypes directly interacts with Insights.RecordAllWorldTypes. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to 1) will increase the amount of data recorded by the Insights system, which could potentially impact performance and storage requirements. It should be used judiciously, particularly in production environments.

Best practices when using this variable include:

  1. Only enable it when debugging or profiling non-Game and non-PIE world types.
  2. Be mindful of the performance impact when enabled.
  3. Disable it (set to 0) when not actively debugging other world types to minimize unnecessary data collection.

Regarding the associated variable CVarRecordAllWorldTypes:

The purpose of CVarRecordAllWorldTypes is to provide programmatic access to the Insights.RecordAllWorldTypes setting within the C++ code. It’s an instance of TAutoConsoleVariable, which allows for runtime modification of the setting.

This variable is used in the Engine module, specifically in the TraceFilters system. It’s checked in the OnWorldInit function to determine whether a world should be marked as traceable.

The value of CVarRecordAllWorldTypes is set through the console variable system, which allows for runtime modification. It can be changed through console commands or configuration files.

CVarRecordAllWorldTypes directly interacts with the world initialization process, influencing which worlds are marked for tracing by the Insights system.

Developers should be aware that changes to CVarRecordAllWorldTypes will immediately affect the behavior of the Insights recording system. It’s important to use GetValueOnAnyThread() when accessing this variable to ensure thread-safe operations.

Best practices for using CVarRecordAllWorldTypes include:

  1. Use it for debugging and profiling purposes only.
  2. Be cautious about enabling it in shipping builds, as it may affect performance.
  3. Consider exposing it as a configurable option for advanced users or developers, but not for end-users.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TraceFilters.cpp:52

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarRecordAllWorldTypes(
	TEXT("Insights.RecordAllWorldTypes"),
	0,
	TEXT("Gameplay Insights recording by default only records Game and PIE worlds.")
	TEXT("Toggle this value to 1 to record other world types."));

FDelegateHandle FTraceWorldFilter::WorldInitHandle;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TraceFilters.cpp:51

Scope: file

Source code excerpt:

}

TAutoConsoleVariable<int32> CVarRecordAllWorldTypes(
	TEXT("Insights.RecordAllWorldTypes"),
	0,
	TEXT("Gameplay Insights recording by default only records Game and PIE worlds.")
	TEXT("Toggle this value to 1 to record other world types."));

FDelegateHandle FTraceWorldFilter::WorldInitHandle;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/TraceFilters.cpp:71

Scope (from outer to inner):

file
function     void FTraceWorldFilter::OnWorldInit

Source code excerpt:

void FTraceWorldFilter::OnWorldInit(UWorld* World, const UWorld::InitializationValues IVS)
{
	if (CVarRecordAllWorldTypes.GetValueOnAnyThread() != 0 ||
			World == nullptr ||
			World->WorldType == EWorldType::Game ||
			World->WorldType == EWorldType::PIE)
	{
		MARK_OBJECT_TRACEABLE(World);
	}