r.Streaming.AllowUpdateResourceSize
r.Streaming.AllowUpdateResourceSize
#Overview
name: r.Streaming.AllowUpdateResourceSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
AllowUpdateResourceSize
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.AllowUpdateResourceSize is to control whether the engine should allow updating the resource size of streamable render assets in the editor. This setting is specifically related to the rendering and asset streaming system in Unreal Engine 5.
This setting variable is primarily used in the Engine module, specifically within the StreamableRenderAsset namespace. It’s part of the asset streaming system, which is responsible for managing the loading and unloading of render assets based on their visibility and importance in the game world.
The value of this variable is set through a console variable, which means it can be changed at runtime or set in configuration files. It’s defined using FAutoConsoleVariableRef, which creates a console variable that can be modified through the console or config files.
The associated variable bAllowUpdateResourceSize directly interacts with r.Streaming.AllowUpdateResourceSize. They share the same value, with bAllowUpdateResourceSize being the actual boolean flag used in the code logic.
Developers must be aware that this variable is only active in editor builds (WITH_EDITOR is defined) and its primary purpose is to trigger resource size updates for streamable render assets. It’s used in conjunction with the FResourceSizeNeedsUpdating system to recalculate asset registry tags.
Best practices when using this variable include:
- Only enable it when necessary, as frequent resource size updates can impact editor performance.
- Be aware that enabling this might cause more frequent asset registry updates.
- Use it in conjunction with other streaming and rendering settings for optimal performance.
Regarding the associated variable bAllowUpdateResourceSize:
The purpose of bAllowUpdateResourceSize is to serve as an in-memory flag that reflects the state of the r.Streaming.AllowUpdateResourceSize console variable. It’s used directly in the code logic to determine whether to update resource sizes.
This variable is used within the Engine module, specifically in the StreamableRenderAsset namespace and the UStreamableRenderAsset class.
Its value is set by the FAutoConsoleVariableRef, which binds it to the r.Streaming.AllowUpdateResourceSize console variable.
bAllowUpdateResourceSize interacts directly with the console variable r.Streaming.AllowUpdateResourceSize, and it’s used in conditional statements to control behavior related to resource size updating.
Developers should be aware that this variable is only relevant in editor builds and its state affects the frequency of resource size updates for streamable render assets.
Best practices include:
- Treat this as a read-only variable in most cases, as its value is controlled by the console variable.
- Use it in conjunction with other editor-specific checks (like GIsEditor) for proper behavior.
- Be mindful of its performance implications when enabled, especially in projects with many streamable render assets.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StreamableRenderAsset.cpp:23
Scope (from outer to inner):
file
namespace StreamableRenderAsset
Source code excerpt:
#if WITH_EDITOR
bool bAllowUpdateResourceSize = false;
FAutoConsoleVariableRef CVarAllowUpdateResourceSize(TEXT("r.Streaming.AllowUpdateResourceSize"), bAllowUpdateResourceSize, TEXT("AllowUpdateResourceSize"));
#endif
}
extern bool TrackRenderAssetEvent(struct FStreamingRenderAsset* StreamingRenderAsset, UStreamableRenderAsset* RenderAsset, bool bForceMipLevelsToBeResident, const FRenderAssetStreamingManager* Manager);
UStreamableRenderAsset::UStreamableRenderAsset(const FObjectInitializer& ObjectInitializer)
#Associated Variable and Callsites
This variable is associated with another variable named bAllowUpdateResourceSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StreamableRenderAsset.cpp:22
Scope (from outer to inner):
file
namespace StreamableRenderAsset
Source code excerpt:
{
#if WITH_EDITOR
bool bAllowUpdateResourceSize = false;
FAutoConsoleVariableRef CVarAllowUpdateResourceSize(TEXT("r.Streaming.AllowUpdateResourceSize"), bAllowUpdateResourceSize, TEXT("AllowUpdateResourceSize"));
#endif
}
extern bool TrackRenderAssetEvent(struct FStreamingRenderAsset* StreamingRenderAsset, UStreamableRenderAsset* RenderAsset, bool bForceMipLevelsToBeResident, const FRenderAssetStreamingManager* Manager);
UStreamableRenderAsset::UStreamableRenderAsset(const FObjectInitializer& ObjectInitializer)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StreamableRenderAsset.cpp:246
Scope (from outer to inner):
file
function void UStreamableRenderAsset::TickStreaming
Source code excerpt:
#if WITH_EDITOR
if (StreamableRenderAsset::bAllowUpdateResourceSize && GIsEditor && bSendCompletionEvents)
{
// When all the requested mips are streamed in, generate an empty property changed event, to force the
// ResourceSize asset registry tag to be recalculated.
FResourceSizeNeedsUpdating::Get().Add(this);
}
#endif