0 votes

Hi all,

I followed the pause tutorial and sample app and managed to create a popup pause menu easily. However I am unable to play an animation upon "unpausing" my game, using the following code :

func _on_btnunpause_pressed():

        $"Popup/lbl-anim".show()
        $Popup/AnimationPlayer.play("anim_unpause")

        $"Popup".hide()
        get_tree().set_pause(false)
        pass # replace with function body

The result is having the game immediately un-paused (as if animation code is non-existent).

Thx

in Engine by (850 points)

What is the Pause mode of the $Popup/AnimationPlayer node?

The pause mode is process (so is the mode of the label that displays a text for 2 seconds)

It is possible that $"Popup".hide() gets called before your animation gets finished, which could cause your issue. Have you connected a method to the animation_finished slot of $Popup/AnimationPlayer?

2 Answers

0 votes
Best answer

As @SASUPERNOVA mentioned, omitting the method:

_on_AnimationPlayer_animation_finished()

function was the issue.

It works great now :-)
Thx

by (850 points)
–1 vote

or your animation runs on a _ready or _process func
reason:
the program will play new animation before u can see that ur animation is playing
i solve that problem using timer on my own project

by (189 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.