diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2019-11-09 09:51:17 +0100 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2019-11-09 09:51:17 +0100 |
commit | 530665197f04f08090e2dda92a50548fb5aca374 (patch) | |
tree | 503d4a1dc1846acc656f0dc92bbde5d1f3b0facb /scene/3d/particles.cpp | |
parent | 621dc7022f9b9e09790481d8915858fa4d007ba4 (diff) |
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
Diffstat (limited to 'scene/3d/particles.cpp')
-rw-r--r-- | scene/3d/particles.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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() { |