The result of the Set Niagara Static Mesh Component (OverrideSystemUserVariableStaticMeshComponent) function provided by the UNiagaraFunctionLibrary is different from the operation result on the details panel of the editor. Specifically, when using the above function, SetParameterOverride is not executed, so Variable is not added to InstanceParameterOverrides of UNiagaraComponent.
The following code will fix this issue.
void UNiagaraFunctionLibrary::OverrideSystemUserVariableStaticMeshComponent(UNiagaraComponent* NiagaraSystem, const FString& OverrideName, UStaticMeshComponent* StaticMeshComponent) { ... // add start FNiagaraVariant NiagaraVariant(StaticMeshInterface); NiagaraSystem->SetParameterOverride(Variable, NiagaraVariant); FPropertyChangedEvent PropertyChangeEvent(UNiagaraComponent::StaticClass()->FindPropertyByName("InstanceParameterOverrides")); NiagaraSystem->PostEditChangeProperty(PropertyChangeEvent); // add end StaticMeshInterface->SetSourceComponentFromBlueprints(StaticMeshComponent); }
expect : two clouds have the same movement
result : Clouds added in EUW do not animate
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-174064 in the post.
0 |
Component | UE - Niagara |
---|---|
Target Fix | 5.4 |
Created | Jan 13, 2023 |
---|---|
Resolved | Oct 17, 2023 |
Updated | Nov 2, 2023 |