bEnableReinstancing
bEnableReinstancing
#Overview
name: bEnableReinstancing
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 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bEnableReinstancing is to control whether object reinstancing is enabled during live coding or hot-reloading of C++ code in Unreal Engine 5. Reinstancing is the process of recreating objects with updated class definitions when code changes are made during runtime.
This setting variable is primarily used in the Live Coding module and the Kismet2 (Blueprint) system, which are part of Unreal Engine’s development and editor subsystems. It’s particularly relevant for the hot-reloading functionality in the editor.
The value of this variable is set in the ULiveCodingSettings class, which suggests it can be configured through the project settings or engine configuration files. It’s also possible to set it programmatically through the FReload class.
This variable interacts with other live coding and hot-reloading related variables, such as bAutomaticallyCompileNewClasses and bPreloadEngineModules.
Developers should be aware that:
- This setting is only effective in the editor (WITH_EDITOR macro).
- Disabling reinstancing may result in some code changes being ignored during hot-reloading.
- When disabled, a message is logged to inform developers that some changes will be ignored.
Best practices when using this variable include:
- Keep it enabled during development to ensure all code changes are properly reflected in the editor.
- Be cautious when disabling it, as it may lead to unexpected behavior if code changes are not fully applied.
- Consider the performance implications of enabling reinstancing, especially in large projects.
- Use it in conjunction with other live coding settings to fine-tune the development experience.
- Monitor the output log for messages related to reinstancing, especially when it’s disabled.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:964, section: [/Script/LiveCoding.LiveCodingSettings]
- INI Section:
/Script/LiveCoding.LiveCodingSettings
- Raw value:
True
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/Windows/LiveCoding/Private/LiveCodingModule.cpp:1444
Scope (from outer to inner):
file
function bool FLiveCodingModule::IsReinstancingEnabled
Source code excerpt:
{
#if WITH_EDITOR
return Settings->bEnableReinstancing;
#else
return false;
#endif
}
bool FLiveCodingModule::AutomaticallyCompileNewClasses() const
#Loc: <Workspace>/Engine/Source/Developer/Windows/LiveCoding/Private/LiveCodingSettings.h:27
Scope (from outer to inner):
file
class class ULiveCodingSettings : public UObject
Source code excerpt:
UPROPERTY(config, EditAnywhere, Category=General, Meta=(EditCondition="bEnabled"))
bool bEnableReinstancing;
UPROPERTY(config, EditAnywhere, Category=General, Meta=(EditCondition="bEnabled", DisplayName="Automatically Compile Newly Added C++ Classes"))
bool bAutomaticallyCompileNewClasses;
UPROPERTY(config, EditAnywhere, Category=Modules, Meta=(ConfigRestartRequired=true, EditCondition="bEnabled"))
bool bPreloadEngineModules;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Kismet2/ReloadUtilities.cpp:855
Scope (from outer to inner):
file
function bool FReload::GetEnableReinstancing
Source code excerpt:
bool FReload::GetEnableReinstancing(bool bHasChanged) const
{
if (bHasChanged && !bEnableReinstancing && !bEnabledMessage)
{
bEnabledMessage = true;
bHasReinstancingOccurred = true;
Ar.Logf(ELogVerbosity::Display, TEXT("Re-instancing has been disabled. Some changes will be ignored."));
}
return bEnableReinstancing;
}
void FReload::Reset()
{
FunctionRemap.Empty();
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/Kismet2/ReloadUtilities.h:68
Scope (from outer to inner):
file
class class FReload : public IReload
function void SetEnableReinstancing
Source code excerpt:
void SetEnableReinstancing(bool bInEnableReinstancing)
{
bEnableReinstancing = bInEnableReinstancing;
}
/**
* Return true if anything was re-instanced
*/
bool HasReinstancingOccurred() const
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/Kismet2/ReloadUtilities.h:162
Scope (from outer to inner):
file
class class FReload : public IReload
Source code excerpt:
/** If true, reinstancing is enabled */
bool bEnableReinstancing = true;
FReinstanceStats ClassStats;
FReinstanceStats EnumStats;
FReinstanceStats StructStats;
FReinstanceStats PackageStats;
int32 NumFunctionsRemapped = 0;