Editor.AsyncStaticMeshCompilationResume

Editor.AsyncStaticMeshCompilationResume

#Overview

name: Editor.AsyncStaticMeshCompilationResume

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 Editor.AsyncStaticMeshCompilationResume is to control the asynchronous compilation of static meshes in the Unreal Engine editor. This setting is part of the performance optimization system for static mesh processing.

This setting variable is primarily used in the Engine module, specifically within the StaticMeshCompiler subsystem. It’s referenced in the StaticMeshCompilingManagerImpl namespace, which suggests it’s closely tied to the static mesh compilation process.

The value of this variable is not directly set in the provided code snippets. However, it’s associated with the bEnableAsyncStaticMeshCompilation variable, which is a member of the UEditorExperimentalSettings class. This suggests that the value is likely set through the editor’s project settings interface.

The bEnableAsyncStaticMeshCompilation variable interacts with this setting. It’s a boolean flag that enables or disables asynchronous static mesh compilation and loading. This variable is initialized to false by default in the UEditorExperimentalSettings constructor.

Developers should be aware that this setting is part of the experimental features in the Unreal Engine editor. As such, its behavior might change in future engine versions, and it may have potential performance implications.

Best practices when using this variable include:

  1. Only enable it if you’re experiencing performance issues with static mesh compilation.
  2. Test thoroughly after enabling to ensure it doesn’t introduce any unexpected behavior in your project.
  3. Keep an eye on engine updates that might affect this feature, as it’s part of the experimental settings.

Regarding the associated variable bEnableAsyncStaticMeshCompilation:

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    StaticMeshCompilingManagerImpl
function     static void EnsureInitializedCVars

Source code excerpt:


			AsyncCompilationHelpers::EnsureInitializedCVars(
				TEXT("staticmesh"),
				CVarAsyncStaticMeshStandard.AsyncCompilation,
				CVarAsyncStaticMeshStandard.AsyncCompilationMaxConcurrency,
				GET_MEMBER_NAME_CHECKED(UEditorExperimentalSettings, bEnableAsyncStaticMeshCompilation));
		}
	}
}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/EditorExperimentalSettings.h:14

Scope (from outer to inner):

file
class        class UEditorExperimentalSettings : public UObject

Source code excerpt:

 */
UCLASS(config=EditorPerProjectUserSettings, MinimalAPI)
class UEditorExperimentalSettings
	: public UObject
{
	GENERATED_UCLASS_BODY()

public:
	/** Enable async texture compilation to improve PIE and map load time performance when compilation is required */
	UPROPERTY(EditAnywhere, config, Category = Performance, meta = (DisplayName = "Enable async texture compilation and loading"))
	bool bEnableAsyncTextureCompilation;

	/** Enable async static mesh compilation to improve import and map load time performance when compilation is required */
	UPROPERTY(EditAnywhere, config, Category = Performance, meta = (DisplayName = "Enable async static mesh compilation and loading"))
	bool bEnableAsyncStaticMeshCompilation;

	/** Enable async skeletal mesh compilation to improve import and map load time performance when compilation is required */
	UE_DEPRECATED(5.1, "Deprecated & replaced by bEnableAsyncSkinnedAssetCompilation.")
	UPROPERTY(/*EditAnywhere - deprecated & replaced by bEnableAsyncSkinnedAssetCompilation, */config/*, Category = Performance, meta = (DisplayName = "Enable async skeletal mesh compilation and loading")*/)
	bool bEnableAsyncSkeletalMeshCompilation;

	/** Enable async skinned asset compilation to improve import and map load time performance when compilation is required */
	UPROPERTY(EditAnywhere, config, Category = Performance, meta = (DisplayName = "Enable async skinned asset compilation and loading"))
	bool bEnableAsyncSkinnedAssetCompilation;

	/** Enable async sound compilation to improve import and map load time performance when compilation is required */
	UPROPERTY(EditAnywhere, config, Category = Performance, meta = (DisplayName = "Enable async sound compilation and loading"))
	bool bEnableAsyncSoundWaveCompilation;

	/** Allows the editor to run on HDR monitors on Windows 10 */
	UPROPERTY(EditAnywhere, config, Category = HDR, meta = (ConfigRestartRequired = true, DisplayName = "Enable Editor Support for HDR Monitors"))
	bool bHDREditor;

	/** The brightness of the slate UI on HDR monitors */
	UPROPERTY(EditAnywhere, config, Category = HDR, meta = (ClampMin = "100.0", ClampMax = "300.0", UIMin = "100.0", UIMax = "300.0"))
	float HDREditorNITLevel;

	/** Allows usage of the procedural foliage system */
	UPROPERTY(EditAnywhere, config, Category = Foliage, meta = (DisplayName = "Procedural Foliage"))
	bool bProceduralFoliage;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/SettingsClasses.cpp:172

Scope (from outer to inner):

file
function     UEditorExperimentalSettings::UEditorExperimentalSettings

Source code excerpt:

	TEXT("Editor.HDRSupport"),
	0,
	TEXT("Sets whether or not we should allow the editor to run on HDR monitors"),
	ECVF_Default);

static TAutoConsoleVariable<float> CVarEditorHDRNITLevel(
	TEXT("Editor.HDRNITLevel"),
	160.0f,
	TEXT("Sets The desired NIT level of the editor when running on HDR"),
	ECVF_Default);

UEditorExperimentalSettings::UEditorExperimentalSettings( const FObjectInitializer& ObjectInitializer )
	: Super(ObjectInitializer)
	, bEnableAsyncTextureCompilation(false)
	, bEnableAsyncStaticMeshCompilation(false)
	, bEnableAsyncSkeletalMeshCompilation(true)	// This was false and set to True in /Engine/Config/BaseEditorPerProjectUserSettings.ini. The setting is removed from .ini so change it to default True.
	, bEnableAsyncSkinnedAssetCompilation(false)
	, bEnableAsyncSoundWaveCompilation(false)
	, bHDREditor(false)
	, HDREditorNITLevel(160.0f)
	, bUseOpenCLForConvexHullDecomp(false)
	, bAllowPotentiallyUnsafePropertyEditing(false)
	, bPackedLevelActor(true)
	, bLevelInstance(true)
{
}

void UEditorExperimentalSettings::PostInitProperties()
{
	PRAGMA_DISABLE_DEPRECATION_WARNINGS
	// bEnableAsyncSkeletalMeshCompilation's default to True (see comment in constructor above).
	// To be backwards compatible, if a user project overrides it to False, pass on the value to bEnableAsyncSkinnedAssetCompilation.
	if (!bEnableAsyncSkeletalMeshCompilation)
	{
		UE_LOG(LogSettingsClasses, Warning, TEXT("bEnableAsyncSkeletalMeshCompilation is deprecated and replaced with bEnableAsyncSkinnedAssetCompilation. Please update the config. Setting bEnableAsyncSkinnedAssetCompilation to False."));
		bEnableAsyncSkinnedAssetCompilation = false;
	}
	PRAGMA_ENABLE_DEPRECATION_WARNINGS

	CVarEditorHDRSupport->Set(bHDREditor ? 1 : 0, ECVF_SetByProjectSetting);
	CVarEditorHDRNITLevel->Set(HDREditorNITLevel, ECVF_SetByProjectSetting);

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

Scope (from outer to inner):

file
namespace    StaticMeshCompilingManagerImpl
function     static void EnsureInitializedCVars

Source code excerpt:

namespace StaticMeshCompilingManagerImpl
{
	static void EnsureInitializedCVars()
	{
		static bool bIsInitialized = false;

		if (!bIsInitialized)
		{
			bIsInitialized = true;

			AsyncCompilationHelpers::EnsureInitializedCVars(
				TEXT("staticmesh"),
				CVarAsyncStaticMeshStandard.AsyncCompilation,
				CVarAsyncStaticMeshStandard.AsyncCompilationMaxConcurrency,
				GET_MEMBER_NAME_CHECKED(UEditorExperimentalSettings, bEnableAsyncStaticMeshCompilation));
		}
	}
}

FStaticMeshCompilingManager::FStaticMeshCompilingManager()
	: Notification(MakeUnique<FAsyncCompilationNotification>(GetAssetNameFormat()))
{
	StaticMeshCompilingManagerImpl::EnsureInitializedCVars();

	PostReachabilityAnalysisHandle = FCoreUObjectDelegates::PostReachabilityAnalysis.AddRaw(this, &FStaticMeshCompilingManager::OnPostReachabilityAnalysis);
}

void FStaticMeshCompilingManager::OnPostReachabilityAnalysis()
{
	if (GetNumRemainingMeshes())
	{
		TRACE_CPUPROFILER_EVENT_SCOPE(FStaticMeshCompilingManager::CancelUnreachableMeshes);

		TArray<UStaticMesh*> PendingStaticMeshes;
		PendingStaticMeshes.Reserve(GetNumRemainingMeshes());

		for (auto Iterator = RegisteredStaticMesh.CreateIterator(); Iterator; ++Iterator)
		{
			UStaticMesh* StaticMesh = Iterator->GetEvenIfUnreachable();
			if (StaticMesh && StaticMesh->IsUnreachable())
			{