0 votes

Hi. I am adding a main menu to my game. The thing I am doing is adding them in a scene and then changing the scene to the game scene. However, my game has errors which belong to other scenes that do not have an instance in the existing scene. I get errors such as:

Invalid get index 'HasEntered' (on base: 'null instance').

My entire project is here
I would appreciate if someone would help me.

Thanks,

Godot version 3.3.2
in Engine by (19 points)

1 Answer

0 votes

What you are trying to do is:

  • Look at the parent node of "Hospital World" -> The parent Node is "Control"
  • Get the child node of "Control" by the name "Hospital" and put it in the variable "HospitalPosition"
  • Try to get the variable "HasEntered" of the instance saved in the "HospitalPosition"-variable

Then Godot raises this error:
Invalid get index 'HasEntered' (on base: 'null instance').

This means the "HospitalPosition"-variable contains a "null instance" because there could not be found a node with the name "Hospital".

When I look into your scene tree, I also can't find a node named Hospital as a parent of "Control". So instancing this scene in the editor or by code should fix this issue.

Btw. never ever use space characters in node, file, or dictionary names!

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