s.AsyncLoadingPrecachePriority
s.AsyncLoadingPrecachePriority
#Overview
name: s.AsyncLoadingPrecachePriority
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Priority of asyncloading precache requests
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of s.AsyncLoadingPrecachePriority is to set the priority for asynchronous loading precache requests in Unreal Engine 5. This setting variable is primarily used in the engine’s asset streaming and loading system.
This setting variable is relied upon by several Unreal Engine subsystems and modules, including:
- CoreUObject: For general async loading operations
- Engine: Specifically for streaming and updating various asset types such as SkeletalMesh, StaticMesh, and Texture2D
The value of this variable is set through a console variable (CVar) system. It’s initialized in the AsyncLoading.cpp file and can be modified at runtime using console commands or through code.
The s.AsyncLoadingPrecachePriority interacts with other variables, particularly:
- CVarStreamingLowResHandlingMode: This determines whether to load assets before async precaching.
- Various asset-specific variables that control IO request priorities.
Developers must be aware that this variable affects the priority of asynchronous loading operations. Higher values will prioritize precache requests, potentially improving loading times for certain assets but also potentially impacting overall system performance if set too high.
Best practices when using this variable include:
- Carefully balancing the priority to ensure critical assets are loaded quickly without starving other important operations.
- Testing different values in various scenarios to find the optimal setting for your specific game or application.
- Consider dynamically adjusting the value based on the current state of the game (e.g., during initial loading vs. during gameplay).
- Monitor performance metrics to ensure that changing this value doesn’t negatively impact overall system performance.
- Use in conjunction with other streaming and loading settings for a comprehensive asset management strategy.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/Serialization/AsyncLoading.cpp:632
Scope: file
Source code excerpt:
int32 GAsyncLoadingPrecachePriority = (int32)AIOP_MIN;
static FAutoConsoleVariableRef CVarAsyncLoadingPrecachePriority(
TEXT("s.AsyncLoadingPrecachePriority"),
GAsyncLoadingPrecachePriority,
TEXT("Priority of asyncloading precache requests"),
ECVF_Default
);
EAsyncIOPriorityAndFlags GetAsyncIOPriority()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Internal/Streaming/SkeletalMeshUpdate.cpp:457
Scope (from outer to inner):
file
function void FSkeletalMeshStreamIn_IO::SetIORequest
Source code excerpt:
if (bHighPrioIORequest)
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StaticMeshUpdate.cpp:573
Scope (from outer to inner):
file
function void FStaticMeshStreamIn_IO::SetIORequest
Source code excerpt:
if (bHighPrioIORequest)
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/Texture2DMipDataProvider_IO.cpp:104
Scope (from outer to inner):
file
function int32 FTexture2DMipDataProvider_IO::GetMips
Source code excerpt:
if (bPrioritizedIORequest)
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/Texture2DStreamIn_IO.cpp:82
Scope (from outer to inner):
file
function void FTexture2DStreamIn_IO::SetIORequests
Source code excerpt:
if (bPrioritizedIORequest)
{
static IConsoleVariable* CVarAsyncLoadingPrecachePriority = IConsoleManager::Get().FindConsoleVariable(TEXT("s.AsyncLoadingPrecachePriority"));
const bool bLoadBeforeAsyncPrecache = CVarStreamingLowResHandlingMode.GetValueOnAnyThread() == (int32)FRenderAssetStreamingSettings::LRHM_LoadBeforeAsyncPrecache;
if (CVarAsyncLoadingPrecachePriority && bLoadBeforeAsyncPrecache)
{
const int32 AsyncIOPriority = CVarAsyncLoadingPrecachePriority->GetInt();
// Higher priority than regular requests but don't go over max