s.AsyncLoadingTimeLimit

s.AsyncLoadingTimeLimit

#Overview

name: s.AsyncLoadingTimeLimit

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 s.AsyncLoadingTimeLimit is to control the maximum amount of time spent on asynchronous loading operations per frame in Unreal Engine 5. This setting variable is primarily used for managing the performance and responsiveness of the engine during asset loading processes.

This setting variable is mainly utilized by the Engine’s core systems, particularly the asynchronous loading system. It’s also referenced in the Mutable plugin, specifically in the CustomizableObjectEditor module.

The value of this variable is set through the console variable system. It can be modified at runtime using console commands or programmatically through the IConsoleManager interface.

Other variables that interact with s.AsyncLoadingTimeLimit include:

  1. GAsyncLoadingTimeLimit, which is directly controlled by this console variable.
  2. MaxConvertToMutableTextureTime, which is used in the CustomizableObjectCompiler to temporarily override the AsyncLoadingTimeLimit.

Developers should be aware of the following when using this variable:

  1. Changing this value affects the balance between loading speed and frame rate stability.
  2. The CustomizableObjectCompiler temporarily modifies this value during its compilation process, which may impact overall engine performance during that time.
  3. The value is in milliseconds per frame.

Best practices when using this variable include:

  1. Monitor frame rates and loading times to find an optimal balance for your specific project.
  2. Be cautious when increasing this value, as it may lead to noticeable frame rate drops or stuttering.
  3. Consider different values for development and shipping builds, as loading behavior may differ.
  4. When temporarily modifying this value (as done in the CustomizableObjectCompiler), ensure to restore the original value after the operation is complete.
  5. Use in conjunction with other asynchronous loading settings for a comprehensive loading strategy.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/CoreSettings.cpp:37

Scope: file

Source code excerpt:


static FAutoConsoleVariableRef CVarAsyncLoadingTimeLimit(
	TEXT("s.AsyncLoadingTimeLimit"),
	GAsyncLoadingTimeLimit,
	TEXT("Maximum amount of time to spend doing asynchronous loading (ms per frame)."),
	ECVF_Default
	);

static FAutoConsoleVariableRef CVarAsyncLoadingUseFullTimeLimit(

#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/CustomizableObjectCompiler.cpp:149

Scope (from outer to inner):

file
function     void FCustomizableObjectCompiler::PreloadingReferencerAssetsCallback

Source code excerpt:

	if (CustomizableObjectCompiler->GetCurrentGAsyncLoadingTimeLimit() != -1.0f)
	{
		static IConsoleVariable* CVAsyncLoadingTimeLimit = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingTimeLimit"));
		if (CVAsyncLoadingTimeLimit)
		{
			CVAsyncLoadingTimeLimit->Set(CustomizableObjectCompiler->GetCurrentGAsyncLoadingTimeLimit());
		}
		CustomizableObjectCompiler->SetCurrentGAsyncLoadingTimeLimit(-1.0f);
	}

#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/CustomizableObjectCompiler.cpp:262

Scope (from outer to inner):

file
function     void FCustomizableObjectCompiler::Compile

Source code excerpt:

			AddCompileNotification(LOCTEXT("LoadingReferencerAssets", "Loading assets"));

			static IConsoleVariable* CVAsyncLoadingTimeLimit = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingTimeLimit"));
			if (CVAsyncLoadingTimeLimit)
			{
				CurrentGAsyncLoadingTimeLimit = CVAsyncLoadingTimeLimit->GetFloat();
				CVAsyncLoadingTimeLimit->Set(MaxConvertToMutableTextureTime * 1000.0f);
			}

#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/CustomizableObjectCompiler.h:185

Scope (from outer to inner):

file
class        class FCustomizableObjectCompiler : public FCustomizableObjectCompilerBase, public FGCObject

Source code excerpt:

	FAssetData* GetCachedAssetData(const FString& PackageName);

	/** Helper function to compute the value for Unreal Engine variable s.AsyncLoadingTimeLimit while asynchronous loading is used.
	* Also assigned to MaxConvertToMutableTextureTime
	* @return value in milliseconds to use for AsyncLoadingTimeLimit and MaxConvertToMutableTextureTime */
	float ComputeAsyncLoadingTimeLimit();
	
public:
	
	virtual void GetCompilationMessages(TArray<FText>& OutWarningMessages, TArray<FText>& OutErrorMessages) const override;