Description

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);
} 
Steps to Reproduce
  1. Open attached project
  2. Remove FXS_CloudParticles of SM_Cloud_A
  3. Select SM_Cloud_A
  4. Open EUW_CloudParticles with RunEditorUtilityWidget 
  5. Press SPAWN FX
  6. PIE

expect : two clouds have the same movement
result : Clouds added in EUW do not animate

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-174064 in the post.

0
Login to Vote

Won't Fix
ComponentUE - Niagara
Target Fix5.4
CreatedJan 13, 2023
ResolvedOct 17, 2023
UpdatedNov 2, 2023
View Jira Issue