summaryrefslogtreecommitdiffstats
path: root/scene/2d/gpu_particles_2d.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-06-12 18:18:51 +0200
committerYuri Sizov <yuris@humnom.net>2023-06-12 18:18:51 +0200
commit991f4d51832b71753c30a289b3b2d4d9a019f7fc (patch)
treeb1958954d707e36cfbd95e9355a2fe0531310886 /scene/2d/gpu_particles_2d.cpp
parent7b1387ff218cd86be77dd7e774542e54251e7ea6 (diff)
downloadredot-engine-991f4d51832b71753c30a289b3b2d4d9a019f7fc.tar.gz
Avoid error spam when (un)pausing GPUParticles out of tree
Diffstat (limited to 'scene/2d/gpu_particles_2d.cpp')
-rw-r--r--scene/2d/gpu_particles_2d.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 08c7b8e131..9fd41ff227 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -551,10 +551,12 @@ void GPUParticles2D::_notification(int p_what) {
case NOTIFICATION_PAUSED:
case NOTIFICATION_UNPAUSED: {
- if (can_process()) {
- RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
- } else {
- RS::get_singleton()->particles_set_speed_scale(particles, 0);
+ if (is_inside_tree()) {
+ if (can_process()) {
+ RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
+ } else {
+ RS::get_singleton()->particles_set_speed_scale(particles, 0);
+ }
}
} break;