LevelStreaming.ShouldReuseUnloadedButStillAroundLevels
LevelStreaming.ShouldReuseUnloadedButStillAroundLevels
#Overview
name: LevelStreaming.ShouldReuseUnloadedButStillAroundLevels
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether level streaming will reuse the unloaded levels that aren\'t GC\'d yet.\n0: Disable, 1: Enable
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of LevelStreaming.ShouldReuseUnloadedButStillAroundLevels is to control whether the level streaming system should reuse unloaded levels that have not yet been garbage collected.
This setting variable is primarily used by the level streaming subsystem within Unreal Engine’s core engine module. It affects how the engine manages memory and performance related to level streaming.
The value of this variable is set as a console variable (cvar) using the FAutoConsoleVariableRef class. It is initialized to true by default but can be changed at runtime through the console or configuration files.
The associated variable bShouldReuseUnloadedButStillAroundLevels directly interacts with this setting. They share the same value, with the console variable acting as an interface for runtime modification.
Developers should be aware that this setting can impact memory usage and performance, especially in game worlds with frequent level streaming. When enabled (set to 1), it allows the engine to reuse unloaded levels that are still in memory, potentially improving performance by reducing memory allocation and deallocation operations.
Best practices when using this variable include:
- Consider the memory implications of your game’s level streaming strategy.
- Test performance with this setting both enabled and disabled to determine the optimal configuration for your specific game.
- Be cautious when modifying this at runtime, as it could affect ongoing level streaming operations.
Regarding the associated variable bShouldReuseUnloadedButStillAroundLevels:
- It is a static boolean variable within the LevelStreamingCVars namespace.
- It is used directly in the ULevelStreaming::ShouldReuseUnloadedButStillAroundLevels function to determine whether to reuse unloaded levels in game worlds.
- This variable provides a quick way to check the current setting without accessing the console variable directly.
- Developers should treat this variable as read-only and use the console variable for any runtime modifications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelStreaming.cpp:83
Scope (from outer to inner):
file
namespace LevelStreamingCVars
Source code excerpt:
static bool bShouldReuseUnloadedButStillAroundLevels = true;
FAutoConsoleVariableRef CVarShouldReuseUnloadedButStillAroundLevels(
TEXT("LevelStreaming.ShouldReuseUnloadedButStillAroundLevels"),
bShouldReuseUnloadedButStillAroundLevels,
TEXT("Whether level streaming will reuse the unloaded levels that aren't GC'd yet.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_ReadOnly);
}
#Associated Variable and Callsites
This variable is associated with another variable named bShouldReuseUnloadedButStillAroundLevels
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelStreaming.cpp:81
Scope (from outer to inner):
file
namespace LevelStreamingCVars
Source code excerpt:
ECVF_Default);
static bool bShouldReuseUnloadedButStillAroundLevels = true;
FAutoConsoleVariableRef CVarShouldReuseUnloadedButStillAroundLevels(
TEXT("LevelStreaming.ShouldReuseUnloadedButStillAroundLevels"),
bShouldReuseUnloadedButStillAroundLevels,
TEXT("Whether level streaming will reuse the unloaded levels that aren't GC'd yet.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_ReadOnly);
}
bool ULevelStreaming::DefaultAllowClientUseMakingInvisibleTransactionRequests()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelStreaming.cpp:138
Scope (from outer to inner):
file
function bool ULevelStreaming::ShouldReuseUnloadedButStillAroundLevels
Source code excerpt:
#endif
UWorld* OuterWorld = InLevel ? InLevel->GetTypedOuter<UWorld>() : nullptr;
if (OuterWorld && OuterWorld->IsGameWorld() && !LevelStreamingCVars::bShouldReuseUnloadedButStillAroundLevels)
{
return false;
}
return true;
}