+1 vote

I have a script in a kinematic body 2d that uses onready var raycast = getnode("DownCast") to find a raycast, but even though the path is right, it still responds with attempt to call function getcollider in base null instance on a null instance. If someone could help i would be very happy.

in Engine by (13 points)
  • What is the organization of your scene tree related to the nodes in question?
  • Which node is the above code attached to?
  • Post the offending code

1 Answer

0 votes

Hi, can you post the scene structure?
Nodes load from bottom to top while getting ready, if the raycast is on top of the kinematic body in the scene tree, then it has not been loaded while the kinematic body is ready and searching for it, so the kinematic body can't find the raycast, because it's not ready yet.

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