Bind event on holding mouse button, not pressing

Hello,
I need to make a continuous line trace on button hold. It should be non stop, and it should move a particle while it is being hold.
Please halp thanks

upd
I tried “spawn emitter at location”. it made the particle follow the camera but it doesn’t follow it precisely, it appears wrong place upon removal and spawning it again. it appears sometimes too left, or too forward

I’d create a bool that checks if the button is pressed or not (bIsButtonPressed). Then I’d bind events to Mouse Pressed and Mouse Released, which will set the bool to true or false respectively. Finally, create a branch in the Tick event, which checks the bool. If the bool is true, call your trace method.

Yes cheers but the thing is, the spawn location happens only on button press instead of being updated everything every event tick. And it just wont
I tried to hook it up to event tick, but the result is crazy

On button pressed, set bool to true,
On release, to false

Problems:
On true, it just keeps spawning new paerticles every tick instead of moving it
On release, I have another action and once I hold release, it will redo it forever,

upd
I tried “spawn emitter at location”. it made the particle follow the camera but it doesn’t follow it precisely, it appears wrong place upon removal and spawning it again. it appears sometimes too left, or too forward

I think this is what you’re looking for. If you’re holding a button, after 2 seconds (or whatever duration you like) it will unlock event tick. Event tick will be active until you “release” that button. You should do your per-tick calculations in the blue comment box. If you’re using event tick for other things not associated with input, you should replace “Set actor tick enabled” calls with “Set EventTickActive bool” or something, and add a branch to only do your hold button events.

(Note in this example, you should have Event Tick turned off initially)

In reference to your

“Problems:
On true, it just keeps spawning new paerticles every tick instead of moving it
On release, I have another action and once I hold release, it will redo it forever,”

When you create your particle, save it as a variable. On event tick, check if that variable is valid. If it is valid then you already have one, you can move it (bypass the spawn call).
If it is not valid, spawn one and set the variable reference, then continue to your movement code.