Update GPUParticles2D/3D speed scale on ENTER_TREE
Fix for https://github.com/godotengine/godot/issues/75218 Pause notifications are not sent when a node is added as a child. So GPUParticles2D should also obey its can_process status on ENTER_TREE, not just PAUSED/UNPAUSED.
This commit is contained in:
parent
6ef2f358c7
commit
4652fbd09e
2 changed files with 10 additions and 0 deletions
|
@ -538,6 +538,11 @@ void GPUParticles2D::_notification(int p_what) {
|
|||
if (sub_emitter != NodePath()) {
|
||||
_attach_sub_emitter();
|
||||
}
|
||||
if (can_process()) {
|
||||
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||
} else {
|
||||
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
|
|
|
@ -439,6 +439,11 @@ void GPUParticles3D::_notification(int p_what) {
|
|||
if (sub_emitter != NodePath()) {
|
||||
_attach_sub_emitter();
|
||||
}
|
||||
if (can_process()) {
|
||||
RS::get_singleton()->particles_set_speed_scale(particles, speed_scale);
|
||||
} else {
|
||||
RS::get_singleton()->particles_set_speed_scale(particles, 0);
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
|
|
Loading…
Reference in a new issue