0 votes

I have two scenes, the second one has an animation that autoplay on load. When I run the second scene (the one with the animation) individually, by pressing F5, that animation autoplay normally. But, when I run the first scene and the code changes to the second scene (using change_scene_to), the animation won't play.

Scene 1

func _on_ScoreTimer_timeout():
    score += 1
    $Scoreboard.text = str(score)
    if score == 5:

Scene 2

func _ready():
Godot version 3.2.3
in Engine by (12 points)
edited by

1 Answer

0 votes

can you provide some sample code ?

What you can do, is include your animation in the _ready() function.
I do not know the kind of animation you want to play, but depending on the type, you sometimes have something to check in the inspector ( Playing -> On)

by (80 points)

I added the sample code to the question

Ok I see. Your code looks correct to me.
Maybe the Label is not ready when you call for the animation for some reasons...

Maybe we can try to call the animation differently ?
What about your emit a signal there (in the scene 2 _ready() ) and catch it in your label (add a small script and connect it to the signal, and make it only AnimationPlayer.play("TitleIn")

It is probably suboptimal though...

Is your AnimationPlayer under your Label node ?

Hey! Sorry for not getting back to you sooner. I figured out the problem, before changing scenes I pause the game, but I didn't know that if I pause the first scene the second one would be paused as well. Just adding a ger.tree().paused = false fixed the problem. But thank you so much for the help!

ah well ^^ You are welcome :D

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.