Godot 3 Particle2D Initial Performance

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Çağdaş Çağlak

Hello,
I have explosion particle node and 2 objects. When one of them hits other one, particle will emitting. There is a no problem while emitting, but when first emit was being, there is a lag after that every thing normal. My code snippet is below. I need to resuse particles but this problem about initialization phase.

onready var explosed = preload("res://Scenes/Explosed.tscn")
var explode = explosed.instance()
explode.position = position
explode.emitting = true
explode.one_shot = true
add_child(explode)

Thank You.

:bust_in_silhouette: Reply From: eons

Is the shader compilation what you are seeing there.
Check Particles2D freezes the game during a few frames when emitting is set to true · Issue #17263 · godotengine/godot · GitHub and related issues.

Is something common by the way, is just hard to notice when you are not making the game…
On release and on certain devices it may not be noticeable, but is particularly bad on web and mobile.


Suggested solutions are to create and keep materials on the scene before starting the game, out of view but keep them around.

CPU particles on 3.1 will help on these cases, but there is no better solution for spatial materials and complex shaders.
Caching may be added with vulkan support later.

I tried this method and it will work but I re-design my particle nodes, now everything works fine.

Thank you.

Çağdaş Çağlak | 2018-09-10 05:41