RequiredSystemUpdateScript

RequiredSystemUpdateScript

#Overview

name: RequiredSystemUpdateScript

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 RequiredSystemUpdateScript is to specify a mandatory Niagara script that must be included in the system update script to control system state in Niagara visual effects.

This setting variable is primarily used by the Niagara plugin, specifically within the NiagaraEditor module. It is utilized in the system initialization process and during script validation.

The value of this variable is set in the Niagara Editor Settings, as indicated by its declaration in the UNiagaraEditorSettings class with the UPROPERTY macro, which includes the ‘config’ specifier.

RequiredSystemUpdateScript interacts with other components of the Niagara system, particularly during system initialization and when checking for script validity. It is used in conjunction with asset loading and graph utilities to ensure the required script is present and properly integrated into the Niagara system.

Developers must be aware that this variable represents a critical component for Niagara systems. Its absence or incorrect configuration could lead to errors or unexpected behavior in the visual effects system.

Best practices when using this variable include:

  1. Ensuring that the specified script exists and is accessible.
  2. Maintaining consistency across projects by standardizing the required system update script.
  3. Considering the impact on existing systems when modifying this setting.
  4. Regularly validating that the specified script meets the necessary requirements for system state control.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:68, section: [/Script/NiagaraEditor.NiagaraEditorSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/NiagaraSystemFactoryNew.cpp:161

Scope (from outer to inner):

file
function     void UNiagaraSystemFactoryNew::InitializeSystem

Source code excerpt:

	if (bCreateDefaultNodes)
	{
		FSoftObjectPath SystemUpdateScriptRef = GetDefault<UNiagaraEditorSettings>()->RequiredSystemUpdateScript;
		UNiagaraScript* Script = Cast<UNiagaraScript>(SystemUpdateScriptRef.TryLoad());

		FAssetData ModuleScriptAsset(Script);
		if (SystemScriptSource && ModuleScriptAsset.IsValid())
		{
			UNiagaraNodeOutput* SpawnOutputNode = FNiagaraStackGraphUtilities::ResetGraphForOutput(*SystemScriptSource->NodeGraph, ENiagaraScriptUsage::SystemSpawnScript, SystemSpawnScript->GetUsageId());

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/Stack/NiagaraStackScriptItemGroup.cpp:630

Scope (from outer to inner):

file
function     void UNiagaraStackScriptItemGroup::RefreshIssues

Source code excerpt:

			// For now, treat this as an error and allow them to resolve.
			const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
			const FAssetData ModuleScriptAsset = AssetRegistryModule.Get().GetAssetByObjectPath(GetDefault<UNiagaraEditorSettings>()->RequiredSystemUpdateScript);

			TArray<UNiagaraNodeFunctionCall*> FoundCalls;
			UNiagaraNodeOutput* MatchingOutputNode = Graph->FindOutputNode(ScriptUsage, ScriptUsageId);
			if (ModuleScriptAsset.IsValid() && !FNiagaraStackGraphUtilities::FindScriptModulesInStack(ModuleScriptAsset, *MatchingOutputNode, FoundCalls))
			{
				bForcedError = true;

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Public/NiagaraEditorSettings.h:364

Scope (from outer to inner):

file
class        class UNiagaraEditorSettings : public UDeveloperSettings

Source code excerpt:

	/** Niagara script which is required in the system update script to control system state. */
	UPROPERTY(config, EditAnywhere, Category = Niagara)
	FSoftObjectPath RequiredSystemUpdateScript;

	/** Validation rules applied to all Niagara systems. */
	UPROPERTY(config, EditAnywhere, Category = Niagara)
	TArray<TSoftObjectPtr<UNiagaraValidationRuleSet>> DefaultValidationRuleSets;

	/** Shortcut key bindings that if held down while doing a mouse click, will spawn the specified type of Niagara node.*/