Niagara: How to set the static mesh parameter of the module Static Mesh Sample from C++?

I defined a user parameter “Static Mesh” and used it in the “Static Mesh Sample” module, but I don’t know hot to set this parameter from C++. Thank you !!

Though this may not be too useful, as this is a blueprint function. SetNiagaraStaticMeshDirectly is the function you’re trying to replicate in C++ from the sounds of it.

Maybe it works similar to setting other Niagara parameters in C++ if you’ve done this before. Might also be worth asking https://discourse.techart.online/ if you haven’t already.

1 Like

I believe you can doubleclick on that blueprint function to open in VS, so you should be able to just read the implementation.

1 Like

Seeing the implementation of NiagaraFunctionLibrary I didn’t found a method called SetNiagaraStaticMeshDirectly, but I got luck with the following:

UNiagaraFunctionLibrary::OverrideSystemUserVariableStaticMeshComponent(
NiagaraComponent, TEXT(“StaticMeshSample”), StaticMesh);

where “StaticMeshSample” is an User Parameter of type StaticMesh I defined inside the NiagaraSystem. Thank you :slight_smile:

1 Like