b.NumGeneratedInstancesLimitLOD2
b.NumGeneratedInstancesLimitLOD2
#Overview
name: b.NumGeneratedInstancesLimitLOD2
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 b.NumGeneratedInstancesLimitLOD2 is to limit the number of mutable instances with LOD 2 (Level of Detail 2) that can exist at a given time in the game. This setting is part of the LOD management system for customizable objects.
This setting variable is primarily used in the Mutable plugin, which is an experimental plugin in Unreal Engine 5 for creating customizable objects. Specifically, it’s used in the CustomizableObject module within the Mutable plugin.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, which means there’s no limit by default. Users can change this value at runtime through the console or configuration files.
The associated variable CVarNumGeneratedInstancesLimitLOD2 directly interacts with b.NumGeneratedInstancesLimitLOD2. They share the same value, and CVarNumGeneratedInstancesLimitLOD2 is used to access the value in the code.
Developers must be aware that:
- This setting only takes effect when its value is different from 0.
- It’s marked with ECVF_Scalability, indicating it’s a scalability setting that can affect performance.
- Changing this value will impact the memory usage and potentially the performance of the game, especially in scenes with many customizable objects.
Best practices when using this variable include:
- Carefully consider the appropriate limit based on your game’s requirements and target hardware capabilities.
- Test thoroughly with different values to find the optimal balance between visual quality and performance.
- Consider exposing this setting to end-users as a graphics option, allowing them to adjust based on their hardware capabilities.
Regarding the associated variable CVarNumGeneratedInstancesLimitLOD2:
The purpose of CVarNumGeneratedInstancesLimitLOD2 is to provide programmatic access to the b.NumGeneratedInstancesLimitLOD2 setting within the C++ code.
This variable is used in the CustomizableInstanceLODManagement class, specifically in the GetNumGeneratedInstancesLimitLOD2() method. This method is likely called by other parts of the Mutable plugin to determine the current limit on LOD 2 instances.
The value of CVarNumGeneratedInstancesLimitLOD2 is set automatically by the CVar system based on the b.NumGeneratedInstancesLimitLOD2 setting.
Developers should be aware that changes to b.NumGeneratedInstancesLimitLOD2 will be reflected in CVarNumGeneratedInstancesLimitLOD2, and vice versa.
Best practices for using CVarNumGeneratedInstancesLimitLOD2 include:
- Always use the GetValueOnGameThread() method to access its value, as shown in the GetNumGeneratedInstancesLimitLOD2() function.
- Don’t modify CVarNumGeneratedInstancesLimitLOD2 directly; instead, change b.NumGeneratedInstancesLimitLOD2 through the console or configuration files.
- Consider caching the value if it’s accessed frequently, to avoid potential performance overhead from repeated CVar lookups.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Plugins/Experimental/Mutable/Config/DefaultMutable.ini:40, section: [ViewDistanceQuality@0]
- INI Section:
ViewDistanceQuality@0
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObject/Private/MuCO/CustomizableInstanceLODManagement.cpp:40
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarNumGeneratedInstancesLimitLOD2(
TEXT("b.NumGeneratedInstancesLimitLOD2"),
0,
TEXT("If different than 0, limit the number of mutable instances with LOD 2 to have at a given time."),
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarDistanceForFixedLOD2(
TEXT("b.DistanceForFixedLOD2"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarNumGeneratedInstancesLimitLOD2
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObject/Private/MuCO/CustomizableInstanceLODManagement.cpp:39
Scope: file
Source code excerpt:
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarNumGeneratedInstancesLimitLOD2(
TEXT("b.NumGeneratedInstancesLimitLOD2"),
0,
TEXT("If different than 0, limit the number of mutable instances with LOD 2 to have at a given time."),
ECVF_Scalability);
static TAutoConsoleVariable<int32> CVarDistanceForFixedLOD2(
#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObject/Private/MuCO/CustomizableInstanceLODManagement.cpp:434
Scope (from outer to inner):
file
function int32 UCustomizableInstanceLODManagement::GetNumGeneratedInstancesLimitLOD2
Source code excerpt:
int32 UCustomizableInstanceLODManagement::GetNumGeneratedInstancesLimitLOD2() const
{
return CVarNumGeneratedInstancesLimitLOD2.GetValueOnGameThread();
}
void UCustomizableInstanceLODManagement::SetNumberOfPriorityUpdateInstances(int32 InNumPriorityUpdateInstances)
{
NumPriorityUpdateInstances = InNumPriorityUpdateInstances;