Editor.AsyncStaticMeshPlayInEditorDebugDraw

Editor.AsyncStaticMeshPlayInEditorDebugDraw

#Overview

name: Editor.AsyncStaticMeshPlayInEditorDebugDraw

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.AsyncStaticMeshPlayInEditorDebugDraw is to enable or disable debug drawing for async static mesh compilation in the Unreal Engine editor’s Play in Editor (PIE) mode.

This setting variable is primarily used by the Engine module, specifically within the static mesh compilation system. It is referenced in the StaticMeshCompiler.cpp file, which is part of the core engine’s runtime.

The value of this variable is set through a console variable (CVar) system. It is initialized as a boolean value, defaulting to false, meaning the debug draw is disabled by default.

The associated variable CVarAsyncStaticMeshDebugDraw directly interacts with Editor.AsyncStaticMeshPlayInEditorDebugDraw. They share the same value and purpose.

Developers should be aware that when enabled (set to true), this variable will cause the engine to draw debug information related to async static mesh compilation. Specifically:

  1. A white collision sphere around the player, which can be adjusted using another variable (Editor.AsyncStaticMeshPlayInEditorDistance).
  2. Green bounding boxes for static meshes affecting physics that are still being compiled.
  3. Red bounding boxes (for a couple of seconds) for static meshes that were waited on due to being too close to the player.

Best practices when using this variable include:

  1. Only enable it when debugging issues related to async static mesh compilation in PIE mode.
  2. Be aware that enabling this debug draw may impact performance, so it should be disabled in production or when not actively debugging.
  3. Use in conjunction with other related variables like Editor.AsyncStaticMeshPlayInEditorDistance for a comprehensive debug view.
  4. Remember to disable it after debugging to avoid unnecessary performance overhead.

Regarding the associated variable CVarAsyncStaticMeshDebugDraw: It serves the same purpose as Editor.AsyncStaticMeshPlayInEditorDebugDraw and is used interchangeably in the code. It’s defined using the TAutoConsoleVariable template, which allows it to be easily accessed and modified at runtime through the console. The variable is checked in the FStaticMeshCompilingManager::FinishCompilationsForGame function to determine whether to show the debug draw. Developers should treat this variable identically to Editor.AsyncStaticMeshPlayInEditorDebugDraw in terms of usage and best practices.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshCompiler.cpp:49

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarAsyncStaticMeshDebugDraw(
	TEXT("Editor.AsyncStaticMeshPlayInEditorDebugDraw"),
	false,
	TEXT("0 - Debug draw for async static mesh compilation is disabled.\n")
	TEXT("1 - Debug draw for async static mesh compilation is enabled.\n")
	TEXT("The collision sphere around the player is drawn in white and can be adjusted with Editor.AsyncStaticMeshPlayInEditorDistance\n")
	TEXT("Any static meshes affecting the physics that are still being compiled will have their bounding box drawn in green.\n")
	TEXT("Any static meshes that were waited on due to being too close to the player will have their bounding box drawn in red for a couple of seconds."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshCompiler.cpp:48

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<bool> CVarAsyncStaticMeshDebugDraw(
	TEXT("Editor.AsyncStaticMeshPlayInEditorDebugDraw"),
	false,
	TEXT("0 - Debug draw for async static mesh compilation is disabled.\n")
	TEXT("1 - Debug draw for async static mesh compilation is enabled.\n")
	TEXT("The collision sphere around the player is drawn in white and can be adjusted with Editor.AsyncStaticMeshPlayInEditorDistance\n")
	TEXT("Any static meshes affecting the physics that are still being compiled will have their bounding box drawn in green.\n")

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshCompiler.cpp:436

Scope (from outer to inner):

file
function     void FStaticMeshCompilingManager::FinishCompilationsForGame

Source code excerpt:

			const int32 PlayInEditorMode = CVarAsyncStaticMeshPlayInEditorMode.GetValueOnGameThread();
			
			const bool bShowDebugDraw = CVarAsyncStaticMeshDebugDraw.GetValueOnGameThread();

			TSet<const UWorld*> PIEWorlds;
			TMultiMap<const UWorld*, FBoxSphereBounds> WorldActors;
			
			float RadiusScale = CVarAsyncStaticMeshPlayInEditorDistance.GetValueOnGameThread();
			for (const FWorldContext& WorldContext : GEngine->GetWorldContexts())