b.NumGeneratedInstancesLimit

b.NumGeneratedInstancesLimit

#Overview

name: b.NumGeneratedInstancesLimit

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of b.NumGeneratedInstancesLimit is to limit the number of mutable instances with full LODs that can exist at a given time in the Unreal Engine. This setting is primarily used for performance optimization and scalability in the Mutable plugin, which is part of the Customizable Object system.

This setting variable is primarily used by the Mutable plugin, which is an experimental feature in Unreal Engine 5 for creating customizable objects. Specifically, it’s used within the CustomizableObject module.

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. The value can be changed at runtime through console commands or programmatically.

The associated variable CVarNumGeneratedInstancesLimit directly interacts with b.NumGeneratedInstancesLimit. They share the same value and purpose. CVarNumGeneratedInstancesLimit is the actual TAutoConsoleVariable object that manages the console variable.

Developers must be aware that:

  1. This variable only takes effect when set to a value greater than 0.
  2. It affects performance and memory usage, as it limits the number of fully detailed (full LOD) mutable instances.
  3. It’s marked with ECVF_Scalability, indicating it’s intended for adjusting performance scaling.

Best practices when using this variable include:

  1. Use it in conjunction with profiling tools to find the optimal balance between performance and visual quality.
  2. Consider the target hardware when setting this value, as lower-end devices may benefit from a lower limit.
  3. Test thoroughly with different values to ensure it doesn’t negatively impact the visual quality of your game.

Regarding the associated variable CVarNumGeneratedInstancesLimit:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/Experimental/Mutable/Config/DefaultMutable.ini:34, section: [ViewDistanceQuality@0]

Location: <Workspace>/Engine/Plugins/Experimental/Mutable/Config/DefaultMutable.ini:48, section: [ViewDistanceQuality@1]

Location: <Workspace>/Engine/Plugins/Experimental/Mutable/Config/DefaultMutable.ini:50, section: [ViewDistanceQuality@2]

Location: <Workspace>/Engine/Plugins/Experimental/Mutable/Config/DefaultMutable.ini:52, section: [ViewDistanceQuality@3]

Location: <Workspace>/Engine/Plugins/Experimental/Mutable/Config/DefaultMutable.ini:54, section: [ViewDistanceQuality@Cine]

#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:28

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNumGeneratedInstancesLimit(
	TEXT("b.NumGeneratedInstancesLimit"),
	0,
	TEXT("If different than 0, limit the number of mutable instances with full LODs to have at a given time."),
	ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarNumGeneratedInstancesLimitLOD1(
	TEXT("b.NumGeneratedInstancesLimitLOD1"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarNumGeneratedInstancesLimit. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObject/Private/MuCO/CustomizableInstanceLODManagement.cpp:27

Scope: file

Source code excerpt:

#endif

static TAutoConsoleVariable<int32> CVarNumGeneratedInstancesLimit(
	TEXT("b.NumGeneratedInstancesLimit"),
	0,
	TEXT("If different than 0, limit the number of mutable instances with full LODs to have at a given time."),
	ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarNumGeneratedInstancesLimitLOD1(

#Loc: <Workspace>/Engine/Plugins/Experimental/Mutable/Source/CustomizableObject/Private/MuCO/CustomizableInstanceLODManagement.cpp:422

Scope (from outer to inner):

file
function     int32 UCustomizableInstanceLODManagement::GetNumGeneratedInstancesLimitFullLODs

Source code excerpt:

int32 UCustomizableInstanceLODManagement::GetNumGeneratedInstancesLimitFullLODs() const
{
	return CVarNumGeneratedInstancesLimit.GetValueOnGameThread();
}


int32 UCustomizableInstanceLODManagement::GetNumGeneratedInstancesLimitLOD1() const
{
	return CVarNumGeneratedInstancesLimitLOD1.GetValueOnGameThread();