Using particles in GUI (SOLVED)

Hello,

I’m trying to use particlefx object in a GUI.
So i’ve defined a particlefx , tuned it, and put it in the gui object.

You can see:

In the attached script of the GUI, i tried to launch the particle like this:

local fw = gui.get_particlefx( "firework")
particlefx.play( fw)

And I get this error:

ERROR:SCRIPT: /data/gui/gui_control.gui_script:43: bad argument #1 to ‘get_particlefx’ (NodeProxy expected, got userdata)

What i understand is firework is not a node object, as it should be for using gui.get_particle(). But i don’t see how i can proceed. Outside a gui, that would be ok, but with a particle attached to Particle FX , i don’t see…

Thank you for reading this between two drinks :wink:

Adding the particle effect to the GUI scene just creates the required ”linking” between the GUI and the particle effect resource file. You need to create a new particle effect node, under ”Nodes”. Right click and select new particle fx node.

When you have the node, get the node and play:

local fw = gui.get_node("firework")
gui.play_particlefx(fw)
4 Likes

Ok, i understand. Thank you for the explaining.

It works perfectly now, soon i can publish my «game» :slight_smile:

3 Likes