This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+7 votes

Hey, how is it possible that the tree isn't accessible?

How can you get notified when it will so that you can make up the things you needed to do in the script when the tree wasn't accessible.

To get this message, it's simple :

  • create a scene
  • create a Node and add it to the scene
  • add it a tool script
  • write func ready():
    get
    tree()
  • then save the file, save the scene, and look at the ouput console
in Engine by (21 points)

2 Answers

+1 vote

Found out how to fix this in GDScript really simply:
Wrap your tree access code in this if statement:

if get_owner() != null:
  # Stuff you want to do with the tree.
  pass
by (29 points)
+1 vote

This is what worked for me in Godot 4:

if self.is_inside_tree(): 
    # Stuff you want to do with the tree.
by (69 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.