Spawning Niagara Systems via C++ code

Hello,

I am trying to create a laser beam in UE4 and C++. I have a Line Trace set up for my FPS, and am currently using DrawDebugLine() to see the trace in action in the editor.

However, I am not able to make the exact same thing work with UNiagaraSystems. I have tried debugging, and it does seem that the values are correct, but I see no system actually spawning.

I have attached a screenshot of my code in this post. The User Params here indicates Parameter EndPoint, which is an exposed param that I created for the Niagara System in the Editor and tied it to the System’s Beam Emitter Setup.

Here are the Debug Lines.

image

You can see the Beam Emitter Setup settings in the next image.

image

Don’t modify the user parameters on the UNiagaraSystem, but use the setters on the spawned component instead.
So TeslaArc->SetVariableVec3() for 4.27 and TeslaArc->SetVariablePosition() for 5.0.

Thank you! That worked for me.

Don’t do it, it’s a bad practice, post the actual code instead.