ai.smartobject.DisableRuntime
ai.smartobject.DisableRuntime
#Overview
name: ai.smartobject.DisableRuntime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If enabled, runtime instances won\'t be created for baked collection entries or runtime added ones from component registration.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ai.smartobject.DisableRuntime is to control the initialization and runtime behavior of the Smart Object system in Unreal Engine 5. It is primarily used for debugging and performance optimization purposes within the Smart Objects plugin.
This setting variable is utilized by the Smart Objects subsystem, which is part of the SmartObjectsModule plugin in Unreal Engine 5. The subsystem is responsible for managing and interacting with Smart Objects in the game world.
The value of this variable is set through a console variable (CVar) named “ai.smartobject.DisableRuntime”. It can be toggled via the console or configuration files.
The associated variable bDisableRuntime directly interacts with ai.smartobject.DisableRuntime. They share the same value and are used interchangeably within the code.
Developers must be aware of the following when using this variable:
- It should be set before launching the game and not toggled during runtime.
- When enabled, it prevents the creation of runtime instances for baked collection entries and runtime-added ones from component registration.
- It affects the initialization of the Smart Object subsystem and the ability to find Smart Objects during gameplay.
Best practices for using this variable include:
- Use it primarily for debugging and performance testing purposes.
- Ensure it is disabled in production builds to maintain full Smart Object functionality.
- When enabled, thoroughly test the game to ensure that the lack of Smart Object runtime instances doesn’t negatively impact gameplay or AI behavior.
Regarding the associated variable bDisableRuntime:
- It serves the same purpose as ai.smartobject.DisableRuntime and is used internally within the SmartObjectSubsystem.
- It is checked in various functions, such as FindSmartObjects and InitializeRuntime, to determine whether to proceed with Smart Object-related operations.
- Developers should not modify bDisableRuntime directly but instead use the console variable ai.smartobject.DisableRuntime to control its value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystem.cpp:42
Scope (from outer to inner):
file
namespace UE::SmartObject
Source code excerpt:
bool bDisableRuntime = false;
FAutoConsoleVariableRef CVarDisableRuntime(
TEXT("ai.smartobject.DisableRuntime"),
bDisableRuntime,
TEXT("If enabled, runtime instances won't be created for baked collection entries or runtime added ones from component registration."),
ECVF_Default);
#if WITH_SMARTOBJECT_DEBUG
namespace Debug
#Associated Variable and Callsites
This variable is associated with another variable named bDisableRuntime
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystem.cpp:40
Scope (from outer to inner):
file
namespace UE::SmartObject
Source code excerpt:
// Indicates that runtime shouldn't be initialized.
// This flag must be set BEFORE launching the game and not toggled after.
bool bDisableRuntime = false;
FAutoConsoleVariableRef CVarDisableRuntime(
TEXT("ai.smartobject.DisableRuntime"),
bDisableRuntime,
TEXT("If enabled, runtime instances won't be created for baked collection entries or runtime added ones from component registration."),
ECVF_Default);
#if WITH_SMARTOBJECT_DEBUG
namespace Debug
{
#Loc: <Workspace>/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystem.cpp:2460
Scope (from outer to inner):
file
function bool USmartObjectSubsystem::FindSmartObjects
Source code excerpt:
{
// Do not report warning if runtime was explicitly disabled by CVar
UE_CVLOG_UELOG(!UE::SmartObject::bDisableRuntime, this, LogSmartObject, Warning,
TEXT("Can't find smart objet before runtime gets initialized (i.e. InitializeRuntime gets called)."));
return false;
}
const FSmartObjectRequestFilter& Filter = Request.Filter;
TArray<FSmartObjectHandle> QueryResults;
#Loc: <Workspace>/Engine/Plugins/Runtime/SmartObjects/Source/SmartObjectsModule/Private/SmartObjectSubsystem.cpp:2719
Scope (from outer to inner):
file
function void USmartObjectSubsystem::InitializeRuntime
Source code excerpt:
void USmartObjectSubsystem::InitializeRuntime()
{
if (UE::SmartObject::bDisableRuntime)
{
UE_VLOG_UELOG(this, LogSmartObject, Verbose, TEXT("Runtime explicitly disabled by CVar. Initialization skipped in %hs."), __FUNCTION__);
return;
}
// Initialize spatial representation structure