DefaultModuleScript
DefaultModuleScript
#Overview
name: DefaultModuleScript
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 DefaultModuleScript is to provide a default template for new Niagara module scripts in Unreal Engine 5’s visual effects system. This setting variable is primarily used in the Niagara plugin, which is part of Unreal Engine’s visual effects framework.
The Niagara Editor module relies on this setting variable, as evidenced by its usage in NiagaraScriptFactory.cpp and NiagaraScratchPadViewModel.cpp. These files are responsible for creating new Niagara scripts and managing the scratch pad functionality in the Niagara editor.
The value of this variable is set in the Niagara Editor Settings, as shown in the NiagaraEditorSettings.h file. It is defined as a configurable property, which means it can be modified through the project settings or configuration files.
DefaultModuleScript interacts with other variables in the Niagara system, such as DefaultDynamicInputScript and RequiredSystemUpdateScript, which serve similar purposes for different types of Niagara scripts.
Developers must be aware that this variable affects the initial content of newly created Niagara module scripts. Changing this setting will impact the default template used for all new module scripts created in the project.
Best practices when using this variable include:
- Ensuring that the referenced default module script is well-designed and follows project-specific conventions.
- Regularly reviewing and updating the default script to incorporate any new best practices or commonly used functionalities.
- Documenting any changes made to the default script to maintain consistency across the development team.
- Using version control to track changes to the default script over time.
- Consider creating different default scripts for various types of modules if the project requires diverse module templates.
By carefully managing this setting, developers can streamline the creation of new Niagara modules and maintain consistency across their visual effects systems.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Plugins/FX/Niagara/Config/BaseNiagara.ini:67, section: [/Script/NiagaraEditor.NiagaraEditorSettings]
- INI Section:
/Script/NiagaraEditor.NiagaraEditorSettings
- Raw value:
/Niagara/DefaultAssets/DefaultModule.DefaultModule
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/NiagaraScriptFactory.cpp:66
Scope (from outer to inner):
file
function const FSoftObjectPath& UNiagaraScriptFactoryNew::GetDefaultScriptFromSettings
Source code excerpt:
{
case ENiagaraScriptUsage::Module:
if (Settings->DefaultModuleScript.IsValid())
{
return Settings->DefaultModuleScript;
}
break;
case ENiagaraScriptUsage::DynamicInput:
if (Settings->DefaultDynamicInputScript.IsValid())
{
return Settings->DefaultDynamicInputScript;
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/NiagaraScratchPadViewModel.cpp:515
Scope (from outer to inner):
file
function TSharedPtr<FNiagaraScratchPadScriptViewModel> UNiagaraScratchPadViewModel::CreateNewScript
Source code excerpt:
case ENiagaraScriptUsage::Module:
{
UNiagaraScript* DefaultModule = Cast<UNiagaraScript>(GetDefault<UNiagaraEditorSettings>()->DefaultModuleScript.TryLoad());
if (DefaultModule != nullptr &&
Cast<UNiagaraScriptSource>(DefaultModule->GetLatestSource()) != nullptr &&
Cast<UNiagaraScriptSource>(DefaultModule->GetLatestSource())->NodeGraph != nullptr)
{
NewScript = CastChecked<UNiagaraScript>(StaticDuplicateObject(DefaultModule, ScriptOuter, GetUniqueScriptName(ScriptOuter, TEXT("ScratchModule"))));
}
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Public/NiagaraEditorSettings.h:360
Scope (from outer to inner):
file
class class UNiagaraEditorSettings : public UDeveloperSettings
Source code excerpt:
/** Niagara script to duplicate as the base of all new script assets created. */
UPROPERTY(config, EditAnywhere, Category = Niagara)
FSoftObjectPath DefaultModuleScript;
/** 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. */