The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I'm using a scene to act as a scene changer, but in its script, it's unable to find it's child nodes.

My structure is like so:

SceneChanger 
   -Control
        -blackRect
   -AnimationPlayer

The two lines of code i use are

onready var animation_player = get_node("AnimationPlayer")
onready var black = get_node("Control/blackRect")

Without fail, they result in a get_node: "node not found" error. This doesnt crash the program, but when I try to call them later, the null pointer does.
I have tried:

get_node("root/SceneChanger/...")
$AnimationPlayer
self.get_node("..")
in Engine by (12 points)

Is this an autoload? Did you autoload the scene or just the script? If you autoload the script, it has no child nodes, so this situation will occur.

Yes, it is an autoload, and I was loading the script not the scene..... I should've seen that. Thanks for the help, much appreciated!!

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.