From 3ec927cfefaa33ca3862a73283cec8fa8d4f29db Mon Sep 17 00:00:00 2001 From: Hristo Stamenov Date: Sun, 24 Oct 2021 19:38:47 +0300 Subject: [PATCH] Setting the visible multimesh instance to -1 so that they are updated correctly on set_amount. When emitting stops CPUParticles3D::_set_redraw(bool p_redraw) will set that value to 0 so when you change the amount after that it will actually not update correclty. This fixes an issue where if it was not emitting when the scene loaded and it start after that the amount is not reflected correclty. This also happened when you checked out the box for emitting in the editor, changed the value of amount and then checked on the box for emitting. With this change if it is emitting during the change it does interrupt the previous particles when you change. The amount and the emit starts from beginning but that is to be expected on an amount of particles change. --- scene/3d/cpu_particles_3d.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 48ef41e015..55feb02fce 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -73,6 +73,7 @@ void CPUParticles3D::set_amount(int p_amount) { } particle_data.resize((12 + 4 + 4) * p_amount); + RS::get_singleton()->multimesh_set_visible_instances(multimesh, -1); RS::get_singleton()->multimesh_allocate_data(multimesh, p_amount, RS::MULTIMESH_TRANSFORM_3D, true, true); particle_order.resize(p_amount);