From 3973c0b64425f589e3c45724ad8a3d3d828991ac Mon Sep 17 00:00:00 2001 From: Travis Lange Date: Wed, 22 Jan 2025 11:29:52 -0500 Subject: [PATCH] fix gpu_particles_3d randomizing seed when set_one_shot is called --- scene/2d/gpu_particles_2d.cpp | 2 ++ scene/3d/gpu_particles_3d.cpp | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index 82b8006c384..23e90582809 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -912,6 +912,8 @@ GPUParticles2D::GPUParticles2D() { one_shot = false; // Needed so that set_emitting doesn't access uninitialized values set_emitting(true); set_one_shot(false); + set_use_fixed_seed(false); + set_seed(0); set_amount(8); set_amount_ratio(1.0); set_lifetime(1); diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 96301d20f68..db2d2f41902 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -92,10 +92,6 @@ void GPUParticles3D::set_one_shot(bool p_one_shot) { if (is_emitting()) { if (!one_shot) { - if (!use_fixed_seed) { - set_seed(Math::rand()); - } - RenderingServer::get_singleton()->particles_restart(particles); } }