bRecompileOnLoad

bRecompileOnLoad

#Overview

name: bRecompileOnLoad

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bRecompileOnLoad is to control whether a Blueprint should be recompiled when it is loaded. This setting variable is primarily used in the Blueprint and RigVM systems of Unreal Engine 5.

This setting variable is relied upon by the following Unreal Engine subsystems and modules:

  1. Blueprint system (Engine module)
  2. RigVM system (RigVM plugin)
  3. Interchange system (Interchange module)

The value of this variable is typically set in the constructor of Blueprint classes or their derivatives. For example, it’s set to 0 (false) in the URigVMBlueprint constructor and to true in the UInterchangeBlueprintPipelineBase constructor.

bRecompileOnLoad interacts with other variables such as:

Developers must be aware of the following when using this variable:

  1. Setting bRecompileOnLoad to true can impact load times, as the Blueprint will be recompiled every time it’s loaded.
  2. It’s used in conjunction with other flags to determine if a Blueprint should be regenerated.
  3. For certain types of Blueprints, like InterchangeBlueprintPipeline, it’s crucial to set this to true to ensure proper functionality.

Best practices when using this variable include:

  1. Only set it to true when necessary, as it can affect performance.
  2. Consider using it in conjunction with bHasBeenRegenerated to ensure one-time recompilation on first load.
  3. Be cautious when modifying this value for existing Blueprints, as it may change their behavior on load.
  4. When creating custom Blueprint types that require regeneration on load, set this to true in the constructor.
  5. Always consider the performance implications of enabling this flag, especially for frequently loaded Blueprints.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:2057, section: [/Script/Engine.Blueprint]

Location: <Workspace>/Engine/Config/BaseEngine.ini:2060, section: [/Script/Engine.LevelScriptBlueprint]

Location: <Workspace>/Engine/Config/BaseEngine.ini:2063, section: [/Script/Engine.AnimBlueprint]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVMDeveloper/Private/RigVMBlueprint.cpp:171

Scope (from outer to inner):

file
function     URigVMBlueprint::URigVMBlueprint

Source code excerpt:

#endif

	bRecompileOnLoad = 0;
	bAutoRecompileVM = true;
	bVMRecompilationRequired = false;
	bIsCompiling = false;
	VMRecompilationBracket = 0;

	bUpdatingExternalVariables = false;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Kismet2/BlueprintEditorUtils.cpp:1957

Scope (from outer to inner):

file
function     bool FBlueprintEditorUtils::ShouldRegenerateBlueprint

Source code excerpt:

{
	return !IsCompileOnLoadDisabled(Blueprint)
		&& Blueprint->bRecompileOnLoad
		&& !Blueprint->bIsRegeneratingOnLoad;
}

bool FBlueprintEditorUtils::IsCompileOnLoadDisabled(UBlueprint* Blueprint)
{
	bool bCompilationDisabled = false;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Blueprint.h:427

Scope (from outer to inner):

file
class        class UBlueprint : public UBlueprintCore, public IBlueprintPropertyGuidProvider

Source code excerpt:

	/** Whether or not this blueprint should recompile itself on load */
	UPROPERTY(config)
	uint8 bRecompileOnLoad:1;

	/** When the class generated by this blueprint is loaded, it will be recompiled the first time.  After that initial recompile, subsequent loads will skip the regeneration step */
	UPROPERTY(transient)
	uint8 bHasBeenRegenerated:1;

	/** State flag to indicate whether or not the Blueprint is currently being regenerated on load */

#Loc: <Workspace>/Engine/Source/Runtime/Interchange/Engine/Public/InterchangeBlueprintPipelineBase.h:20

Scope (from outer to inner):

file
class        class UInterchangeBlueprintPipelineBase : public UBlueprint
function     UInterchangeBlueprintPipelineBase

Source code excerpt:

		ParentClass = UInterchangePipelineBase::StaticClass();
		//We must make sure the GeneratedClass is generated after the blueprint is loaded
		bRecompileOnLoad = true;
	}
};