From 530665197f04f08090e2dda92a50548fb5aca374 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Sat, 9 Nov 2019 09:51:17 +0100 Subject: Fixed Particles restart after visibility has been set to off and on again Make sure particles are processed during the same frame when visibility is set to on, in case they are still active from before and need to be restarted. Fixed #33476 --- scene/3d/particles.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scene/3d/particles.cpp') diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 241eb7d1ca..06b5613eb8 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -331,6 +331,13 @@ void Particles::_notification(int p_what) { set_process_internal(false); } } + + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { + // make sure particles are updated before rendering occurs if they were active before + if (is_visible_in_tree() && !VS::get_singleton()->particles_is_inactive(particles)) { + VS::get_singleton()->particles_request_process(particles); + } + } } void Particles::_bind_methods() { -- cgit v1.2.3