Navigation
API > API/Plugins > API/Plugins/Niagara
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UNiagaraScriptBase
- UNiagaraScript
References
| Module | Niagara |
| Header | /Engine/Plugins/FX/Niagara/Source/Niagara/Classes/NiagaraScript.h |
| Include | #include "NiagaraScript.h" |
Syntax
UCLASS (MinimalAPI)
class UNiagaraScript :
public UNiagaraScriptBase ,
public FNiagaraVersionedObject
Remarks
Scripts are function graphs that define the runtime execution for a Niagara system (similar to a Blueprint).
There are three types of scripts: 1) Module: can be added as a standalone part to the emitter stack and encapsulates a single behavior, for example "Add Velocity" 2) Dynamic input: has a single output value and can be added to any input in the stack to compute such a value, for example "Random Vector" 3) Function: usually reserved for helper functions; can only be called from within modules or dynamic inputs
Variables
| Type | Name | Description | |
|---|---|---|---|
| FNiagaraParameterStore | RapidIterationParameters | Contains all of the top-level values that are iterated on in the UI. | |
| FNiagaraParameterStore | RapidIterationParametersCookedEditorCache | ||
| ENiagaraScriptUsage | Usage | How this script is to be used. cannot be private due to use of GET_MEMBER_NAME_CHECKED | |
| TArray< TObjectPtr< UNiagaraValidationRule > > | ValidationRules | A set of rules to apply when this script is used in the stack. | |
| FGuid | VersionToOpenInEditor | This is used as a transient value to open a specific version in the graph editor |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UNiagaraScript
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | ApplyRapidIterationParameters
(
TConstArrayView< FNiagaraVariable > InParameters, |
Updates the RI parameter store based on the provided variables (missing entries will be added and stale entries will be removed. Returns true if the parameter store was modified. | |
| bool | Infrastructure for GPU compute Shaders. | ||
| bool | AreScriptAndSourceSynchronized
(
const FGuid& VersionGuid |
Determine if the Script and its source graph are in sync. | |
| void | AssignRapidIterationParameters
(
const FNiagaraVMExecutableData& InScriptVM |
||
| bool | BinaryToExecData
(
const UNiagaraScript* Script, |
Helper to convert the struct from its binary data out of the DDC to it's actual in-memory version. | |
| void | BuildClassSchema
(
FAppendToClassSchemaContext& Context |
Called from UNiagaraSystem::AppendToClassSchema() to collect the Script specific details for iterative cooking | |
| FString | BuildNiagaraDDCKeyString
(
const FNiagaraVMExecutableDataId& CompileId, |
Builds the DDC string for the derived data cache using the supplied CompiledId and ScriptPath | |
| void | CacheResourceShadersForCooking
(
EShaderPlatform ShaderPlatform, |
||
| void | CacheResourceShadersForRendering
(
bool bRegenerateId, |
||
| void | CacheShadersForResources
(
FNiagaraShaderScript* ResourceToCache, |
||
| bool | |||
| void | Makes sure that the default version data is available and fixes old script assets. | ||
| void | Clears out resolved runtime data. | ||
| void | ComputeVMCompilationId
(
FNiagaraVMExecutableDataId& Id, |
||
| bool | ContainsEquivilentUsage
(
const TArray< ENiagaraScriptUsage >& Usages, |
||
| bool | ContainsUsage
(
ENiagaraScriptUsage InUsage |
||
| bool | ConvertUsageToGroup
(
ENiagaraScriptUsage InUsage, |
||
| UNiagaraScript * | Creates a shallow transient copy of this script for compilation purposes. | ||
| bool | DidScriptCompilationSucceed
(
bool bGPUScript |
||
| bool | ExecToBinaryData
(
const UNiagaraScript* Script, |
Reverse of the BinaryToExecData() function | |
| TArray< FName > | FindShaderFormatsForCooking
(
const ITargetPlatform* TargetPlatform |
||
| void | GatherScriptStaticVariables
(
TArray< FNiagaraVariable >& StaticVariables |
Use of this function differs from the above in that the data is being pulled from the RapidIterationParameters rather than the compiled data | |
| void | |||
| FGuid | GetBaseChangeID
(
const FGuid& VersionGuid |
||
| TConstArrayView< FNiagaraScriptDataInterfaceInfo > | |||
| TArray< FNiagaraScriptDataInterfaceInfo > & | |||
| TConstArrayView< FNiagaraScriptUObjectCompileInfo > | |||
| TArrayView< FNiagaraScriptUObjectCompileInfo > | |||
| TArray< TObjectPtr< UNiagaraParameterCollection > > & | |||
| TOptional< T > | GetCompiledStaticVariableValue
(
const FNiagaraVariableBase& InVar |
||
| TOptional< FVector3d > | GetCompilerTag
(
const FNiagaraVariableBase& InVar, |
||
| TOptional< T > | GetCompilerTag
(
const FNiagaraVariableBase& InVar, |
||
| const FNiagaraVMExecutableDataId & | |||
| TConstArrayView< FNiagaraDataInterfaceGPUParamInfo > | |||
| FText | GetDescription
(
const FGuid& VersionGuid |
||
| const FNiagaraScriptExecutionParameterStore * | GetExecutionReadyParameterStore
(
ENiagaraSimTarget SimTarget |
||
| FString | |||
| ENiagaraScriptCompileStatus | |||
| const FVersionedNiagaraScriptData * | |||
| FVersionedNiagaraScriptData * | Returns the script data for latest exposed version. | ||
| const UNiagaraScriptSourceBase * | |||
| UNiagaraScriptSourceBase * | |||
| FString | GetNiagaraDDCKeyString
(
const FGuid& ScriptVersion, |
Creates a string key for the derived data cache | |
| FVersionedNiagaraEmitter | Workaround for emitter versioning because we used a lot of Script->GetOuter() previously. | ||
| ERHIFeatureLevel::Type | |||
| const FNiagaraShaderScript * | |||
| FNiagaraShaderScript * | |||
| TConstArrayView< FNiagaraScriptResolvedDataInterfaceInfo > | |||
| TConstArrayView< FNiagaraResolvedUObjectInfo > | |||
| TConstArrayView< FNiagaraResolvedUserDataInterfaceBinding > | |||
| const FVersionedNiagaraScriptData * | GetScriptData
(
const FGuid& VersionGuid |
||
| FVersionedNiagaraScriptData * | GetScriptData
(
const FGuid& VersionGuid |
Returns the script data for a specific version or nullptr if no such version is found. | |
| UNiagaraScriptSourceBase * | |||
| const UNiagaraScriptSourceBase * | |||
| TArray< ENiagaraScriptUsage > | GetSupportedUsageContextsForBitmask
(
int32 InModuleUsageBitmask, |
||
| ENiagaraScriptUsage | GetUsage () |
||
| FGuid | GetUsageId () |
||
| const FNiagaraVMExecutableData & | |||
| FNiagaraVMExecutableData & | |||
| const FNiagaraVMExecutableDataId & | |||
| FGraphEventRef | HandleByteCodeOptimization
(
bool bShouldForceNow |
Kicks off an async job to convert the ByteCode into an optimized version for the platform we are running on. | |
| bool | HandleVariableRenames
(
const TMap< FNiagaraVariable, FNiagaraVariable >& OldToNewVars, |
||
| bool | |||
| void | InvalidateCompileResults
(
const FString& Reason |
||
| void | |||
| bool | IsCompilable
(
ENiagaraScriptUsage Usage |
||
| bool | IsCompilable () |
||
| bool | IsDynamicInputScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsEmitterScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsEmitterSpawnScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsEmitterUpdateScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsEquivalentUsage
(
ENiagaraScriptUsage InUsage |
||
| bool | IsEquivalentUsage
(
ENiagaraScriptUsage InUsageA, |
||
| bool | |||
| bool | IsFunctionScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsGPUScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsGPUScript () |
||
| bool | |||
| bool | |||
| bool | IsModuleScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsNonParticleScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | |||
| bool | IsParticleEventScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsParticleScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsParticleSpawnScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsParticleStageScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsParticleUpdateScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsReadyToRun
(
ENiagaraSimTarget SimTarget |
||
| bool | IsScriptCompilationPending
(
bool bGPUScript |
||
| bool | |||
| bool | IsScriptShaderSynchronized
(
const FGuid& VersionGuid |
||
| bool | IsShaderMapCached
(
const ITargetPlatform* TargetPlatform, |
||
| bool | |||
| bool | IsSpawnScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsStandaloneScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsSupportedUsageContextForBitmask
(
int32 InModuleUsageBitmask, |
||
| bool | IsSystemScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsSystemSpawnScript
(
ENiagaraScriptUsage Usage |
||
| bool | IsSystemUpdateScript
(
ENiagaraScriptUsage Usage |
||
| bool | |||
| bool | IsUsageDependentOn
(
ENiagaraScriptUsage InUsageA, |
Is usage A dependent on Usage B? | |
| void | MarkScriptAndSourceDesynchronized
(
FString Reason, |
Ensure that the Script and its source graph are marked out of sync. | |
| FOnScriptCompiled & | Callback issued whenever a GPU script compilation successfully happened (even if the results are a script that cannot be executed due to errors) | ||
| FOnPropertyChanged & | Callback issues whenever post edit changed is called on this script. | ||
| FOnScriptCompiled & | Callback issued whenever a VM script compilation successfully happened (even if the results are a script that cannot be executed due to errors) | ||
| void | PostEditChangeVersionedProperty
(
FPropertyChangedEvent& PropertyChangedEvent, |
||
| void | |||
| void | RequestCompile
(
const FGuid& ScriptVersion, |
Request a synchronous compile for the script, possibly forcing it to compile. | |
| bool | RequestExternallyManagedAsyncCompile
(
const TSharedPtr< FNiagaraCompileRequestDataBase, ESPMode::ThreadSafe >& RequestData, |
Request an asynchronous compile for the script, possibly forcing it to compile. | |
| void | SaveShaderStableKeys
(
const ITargetPlatform* TP |
||
| void | SetComputeCompilationResults
(
const ITargetPlatform* TargetPlatform, |
||
| void | SetLatestSource
(
UNiagaraScriptSourceBase* InSource |
||
| void | SetPreviewFeatureLevel
(
ERHIFeatureLevel::Type PreviewFeatureLevel |
||
| void | SetResolvedDataInterfaces
(
const TArray< FNiagaraScriptResolvedDataInterfaceInfo >& InResolvedDataInterfaces |
||
| void | SetResolvedUObjects
(
TConstArrayView< FNiagaraResolvedUObjectInfo > InResolvedUObjectInfos |
||
| void | SetResolvedUserDataInterfaceBindings
(
const TArray< FNiagaraResolvedUserDataInterfaceBinding >& InResolvedUserDataInterfaceBindings |
||
| void | SetSource
(
UNiagaraScriptSourceBase* InSource, |
||
| void | SetUsage
(
ENiagaraScriptUsage InUsage |
||
| void | SetUsageId
(
const FGuid& InUsageId |
||
| void | SetVMCompilationResults
(
const FNiagaraVMExecutableDataId& InCompileId, |
External call used to identify the values for a successful VM script compilation. | |
| bool | ShouldUseDDC () |
||
| void | SyncAliases
(
const FNiagaraAliasContext& ResolveAliasesContext |
||
| bool | SynchronizeExecutablesWithCompilation
(
const UNiagaraScript* Script, |
In the event where we "merge" we duplicate the changes of the source script onto the newly cloned copy. | |
| bool | UsesCollection
(
const UNiagaraParameterCollection* Collection |
Overridden from UNiagaraScriptBase
| Type | Name | Description | |
|---|---|---|---|
| TConstArrayView< FSimulationStageMetaData > | |||
| void | ModifyCompilationEnvironment
(
EShaderPlatform Platform, |
||
| bool | ShouldCompile
(
EShaderPlatform Platform |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginCacheForCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
Starts caching of platform specific data for the target platform Called when cooking before serialization so that object can prepare platform specific data Not called during normal loading of objects | |
| void | BeginDestroy () |
Called before destroying the object. | |
| void | GetAssetRegistryTags
(
FAssetRegistryTagsContext Context |
Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects | |
| void | GetAssetRegistryTags
(
TArray< FAssetRegistryTag >& OutTags |
||
| bool | IsCachedCookedPlatformDataLoaded
(
const ITargetPlatform* TargetPlatform |
Have we finished loading all the cooked platform data for the target platforms requested in BeginCacheForCookedPlatformData | |
| bool | IsEditorOnly () |
Called during saving to determine if the object is forced to be editor only or not | |
| bool | Called to check if the object is ready for FinishDestroy. | ||
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally | |
| void | PostEditUndo () |
Called after applying a transaction to the object. | |
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | PreSave
(
FObjectPreSaveContext ObjectSaveContext |
Presave function. | |
| void | Handles reading, writing, and reference collecting using FArchive. |
Overridden from FNiagaraVersionedObject
| Type | Name | Description | |
|---|---|---|---|
| FGuid | AddNewVersion
(
int32 MajorVersion, |
Creates a new data entry for the given version number. | |
| void | DeleteVersion
(
const FGuid& VersionGuid |
Deletes the version data for an existing version. | |
| void | DisableVersioning
(
const FGuid& VersionGuidToUse |
Disables versioning and keeps only the data from the given version guid. | |
| void | Enables versioning for this script asset. | ||
| void | ExposeVersion
(
const FGuid& VersionGuid |
Changes the exposed version. Does nothing if the guid does not exist in the script's version data. | |
| FNiagaraAssetVersion const * | FindVersionData
(
const FGuid& VersionGuid |
Returns the version data for the given guid, if it exists. Otherwise returns nullptr. | |
| TArray< FNiagaraAssetVersion > | Returns all available versions for this script. | ||
| FNiagaraAssetVersion | Returns the version of the exposed version data (i.e. the version used when adding a module to the stack) | ||
| TSharedPtr< FNiagaraVersionDataAccessor > | GetVersionDataAccessor
(
const FGuid& Version |
||
| bool | If true then this script asset uses active version control to track changes. |
Typedefs
| Name | Description |
|---|---|
| FOnPropertyChanged | |
| FOnScriptCompiled |
Constants
| Name | Description |
|---|---|
| LogCompileStaticVars | |
| NiagaraCustomVersionTagName |
Deprecated Variables
| Type | Name | Description | |
|---|---|---|---|
| uint32: 1 | bDeprecated_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| uint32: 1 | bExperimental_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| uint32: 1 | bExposeToLibrary_DEPRECATED | Deprecated, use LibraryVisibility instead. | |
| FText | Category_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| FText | CollapsedViewFormat_DEPRECATED | Deprecated, use LibraryVisibility instead. | |
| TSubclassOf< UNiagaraConvertInPlaceUtilityBase > | ConversionUtility_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| FText | DeprecationMessage_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| TObjectPtr< UNiagaraScript > | DeprecationRecommendation_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| FText | Description_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| FText | ExperimentalMessage_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| FText | Keywords_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| ENiagaraScriptLibraryVisibility | LibraryVisibility_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| int32 | ModuleUsageBitmask_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| FText | NoteMessage_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| ENiagaraNumericOutputTypeSelectionMode | NumericOutputTypeSelectionMode_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| TArray< FName > | ProvidedDependencies_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| TArray< FNiagaraModuleDependency > | RequiredDependencies_DEPRECATED | Use property in struct returned from GetScriptData() instead | |
| TMap< FName, FString > | ScriptMetaData_DEPRECATED | Deprecated, use LibraryVisibility instead. | |
| TObjectPtr< class UNiagaraScriptSourceBase > | Source_DEPRECATED | 'Source' data/graphs for this script | |
| int32 | UsageIndex_DEPRECATED | Which instance of the usage in the graph to use. This is now deprecated and is handled by UsageId. |