Topic was automatically imported from the old Question2Answer platform.
Asked By
haha-lolcat1
hi all,
for some reason when I set get_tree().paused = true, I can’t control the particles2d pause process.
for example, if I have a moving sprite (controlled by Tween) and an ongoing particles2d object, if I set both nodes to .pause_mode = 2 during the pause, the sprite will start moving again, but particles2d won’t.
why is that?
here is a code example:
func _input(event):
if event.is_action_pressed("ui_cancel"):
get_tree().paused = !get_tree().paused
if event.is_action_pressed("ui_accept"):
$Particles2D.pause_mode = 1
$Tween.pause_mode = 1
if event.is_action_pressed("ui_select"):
$Particles2D.pause_mode = 2 ## does not resume particles during pause
$Tween.pause_mode = 2 ## resumes the sprite movement during pause
Why node just use get_tree().paused to pause the game, then for the objects that you don’t want to pause just set their pause mode to process(found by clicking on the node, then the scroll down to the bottom in the Inspector window)
it might be bit complicated to explain, but from the PauseMenu I can either quit to the MainMenu (change_scene()) or Exit the game (get_tree().quit()).
When either of these happens, there is a fade out animation playing.
During this fade out, I need everything to be paused, except for the particles animation.
But during the actual pause (when PauseMenu is displayed), these particles must be paused.
Since Godot does not have an individual pause() functionality, I am looking for a workaround using pause_mode, but it seems that it may be related to the fact the the resource material is also being paused
haha-lolcat1 | 2022-01-04 17:48
Then would this work?:
setting the particles to process
using the .visible property to display the particles when needed
using a black sprite then adjusting it’s transparency, then using .visible again on the sprite
PhantomPixel | 2022-01-09 07:14
well, I always need them to be visible, either animated or frozen, depending on the conditions.
I think it has to do with the resource material being paused, because the Particles2D node itself works as it should (I think)
I ended up manually playing with the pause mode and unpausing like so: