0 votes


i have a get_node() command in the kinematicbody script, but it returns error with
the node being a null instance. in other non-autoload nodes it works fine. what is happening??

Godot version 3.3
in Engine by (25 points)

2 Answers

0 votes

Read about autoload in documentation more
Autoload exists aside of the sene tree, it is a nodeless script. It can't have children and any structure, so get_node can't work. It also doesn't have any way of reaching a scene tree, get_tree() returns null. However every node of your scene tree can refer to Autoload scriptwithout any knowledge of own scene tree structure, and this where it becomes truely useful

by (8,099 points)
0 votes

Why are you autoloading your KinematicBody in the first place? Just instance it in the scene tree where you need it...

by (14 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 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.