Gui.new_particle_fx not working (SOLVED)

Hi !
I am trying to spawn a particle_fx node and activate it instantly, but something dosen’t work and I can’t figure what is wrong

local fdb = gui.new_particlefx_node(message.position,hash("hit_feedback"))
particlefx.play(fdb)

The “hit_feedback” particle_fx is in the UI file as needed
When I try to print fdb I get "unknown@(15.1321561,15.561561515,0)
So I guess the node has failed being created

When you say

it’s usually good to write what is going wrong (in this case, the effect does not start). In this case it’s deducible, that it’s the case, but in general it will be easier to track the error if we know what the expected behavior is, and what behavior you are receiving instead! :smile:

Now, to the point: one error is that you are calling

particlefx.play(fdb)

instead of

gui.play_particlefx(fdp)

Does it work if you change it to this?

1 Like

Yes thank you very much !
Maybe it could be nice to write something about it in the particle FX reference, just one line to warn people about the fact that they must look at the GUI reference if they want to use particule FX into GUI :slightly_smiling_face:

1 Like

Well, particlefx.play() always takes the URL of a particle emitter component as its argument, not a GUI node. I’d say the naming of gui.new_particlefx_node() - and its entry in the API reference - makes it clear enough that it creates a GUI node, rather than a particle emitter component. If the reader has found their way to the API reference, then I’d say this suffices, but if you feel it’s lacking, then perhaps it doesn’t!

1 Like

Since I started to learn using Defold, the duality between the GUI and the collection environnement has always been a factor of confusion, I understand the logic you hilight but I couldn’t find it wihout your precious help :sweat_smile:
The idea of sharing assets and behaviors between game objects and GUI nodes is wonderful but it makes the editor tricky to understand because the boundaries are blurred by big similarities and tiny differences :thinking:
That’s why I think it could be good to prevent confusion in the documentation by telling users that this or this feature can be used in GUI or GO and send users to the respective pages !
That’s a bit off topic so thank you again and may the bugs stay away from you :stuck_out_tongue:

2 Likes