bEnableAsyncStaticMeshCompilation

bEnableAsyncStaticMeshCompilation

#Overview

name: bEnableAsyncStaticMeshCompilation

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bEnableAsyncStaticMeshCompilation is to enable asynchronous compilation and loading of static meshes in Unreal Engine 5. This setting is designed to improve import and map load time performance when compilation of static meshes is required.

This setting variable is primarily used by the Unreal Editor’s performance optimization systems, specifically in the static mesh compilation and loading processes. It is part of the Editor Experimental Settings, which suggests it’s a feature that may still be in testing or refinement stages.

The value of this variable is set in the UEditorExperimentalSettings class, which is defined in the EditorExperimentalSettings.h file. It’s a boolean property that can be edited in the project settings under the Performance category.

This variable interacts with other async compilation settings in the same class, such as bEnableAsyncTextureCompilation and bEnableAsyncSkinnedAssetCompilation. It’s part of a broader strategy to optimize asset compilation in the Unreal Engine editor.

Developers should be aware that enabling this feature may affect the stability or behavior of the editor, as it’s part of the experimental settings. It’s important to test thoroughly when enabling this feature to ensure it doesn’t introduce any unexpected issues in your specific project.

Best practices when using this variable include:

  1. Enable it in projects with a large number of static meshes to potentially improve load times.
  2. Monitor performance and stability after enabling to ensure it’s beneficial for your specific use case.
  3. Use in conjunction with other async compilation settings for potentially greater performance improvements.
  4. Be prepared to disable it if you encounter any issues, as it’s an experimental feature.
  5. Keep your Unreal Engine version up to date, as improvements or changes to this feature may be introduced in newer versions.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:157, section: [/Script/UnrealEd.EditorExperimentalSettings]

#References in C++ code

#Callsites

This variable is referenced in 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())
			{