A problem with particle system serializations


I’ve been trying to serialize a particle system with sub-emitters. One of the sub-emitters is linked to some other sub-sub-emitters. When I serialized and reload it, the system changed.
Specifically, the original system launched 5 particles in a row and each exploded into sub-particles, while for the serialized one, only the first 2 particles exploded. I checked the inspector while running, it seemed that the sub-emitter disposed before the time I set. Below are the codes:
Original system: https://playground.babylonjs.com/#GXTHL9#23
Serialized system: https://playground.babylonjs.com/#GXTHL9#22
Start both systems by pressing the space bar.


Pinging @Evgeni_Popov if he has a bit of time to check


I tried to printed out some results, and I found that the sub-sub-emitters were lost after reloading. I also checked the serializing results, it seems that those sub-sub-emitters are preserved. So I think the error came from the parsing step instead of the serializing step.

I’m currently working on this.

This PR should fix the problem:

1 Like

Thank you for your quick reply. That really helps!

I found another problem with the sub-emitter. When I changed the sub-sub-emitters to type “END”, it won’t run as expected. I saw those emitters in the inspector, but it seems that they never started (specifically the createSystem() function). The examples are shown below:
Original: https://playground.babylonjs.com/#GXTHL9#37
Serialized: https://playground.babylonjs.com/#GXTHL9#38
Start both systems by pressing the space bar .

Let’s hope this new PR is ok:


1 Like

It seems that the second-stage explosion is still missing. I tried to add sub-emitters manually, then the code worked correctly. (line 223 in https://playground.babylonjs.com/#GXTHL9#45)


The latest PR is not deployed to the Playground yet, so the fix is not in.

Ah! That makes sense. I tried to change the node modules locally, and it does work now. Thanks again!