I am experiencing an issue with Niagara bool module parameter.
Unreal version affected by this is both UE 5.0 and 5.1.
I am trying to implement a bool variable within a Niagara module script, which tracks whether an action has been performed. This is done in order to implement a DO ONCE kind of behaviour.
This variable has namespace “Particle” (as the action is performed per particle) and namespace modifier “Module” (as a variable should be implemented per module instance).
Let’s call the variable HasAlreadyDone.
Given a input bool trigger param DoOnce, we will perform the action based on the following condition statement:
!(HasAlreadyDone && DoOnce)
We’ll trigger the action when we haven’t triggered an action yet (HasAlreadyDone is FALSE), if we want to trigger the action more than once (DoOnce is FALSE) or if they are both false.
After triggering the action HasAlradyDone is set to based on the following condition statement:
HasAlreadyDone || !(HasAlreadyDone && DoOnce).
See the pictures attached.
The module works fine in Editor as you implement it.
However it doesn’t in standalone or after reloading the editor.
The unwanted outcome is the action being performed several times although DoOnce is set to true.
I have the feeling is something related to the HasAlreadyDone variable being maybe reinitialised at the beginning of the particle stage?!
However what confuses the most is that if I re-save the module and then test it in the editor it works again!