0 votes

I'm new in Godot and am doing a flappy bird tutorial on youtube. I tried to call the animation "fade_out" from the animationplayer, but it gives out null instance. But I already made the animation and it is saved already. What's wrong here?

Screenshot of the error in script and the animation

in Engine by (14 points)

The screenshots are missing. You can include code in your post by clicking the "{ }"-icon in the editor on this page.

I could load the picture by right clicking it, but somehow it doesn't show right here automatically...

1 Answer

+1 vote

Sounds like you're not getting the right object. Or rather: any object. Make sure, the node path is correct, e.g. if you have a scene consisting of a parent node (where the script is attached) and it's child of type AnimationPlayer called "A", your script should include:

get_node("A").play("fade_out")
by (10,329 points)

Ah yes thank you. Turns out its not referencing the right scene. I forgot to autoload the scene globally.

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.