+2 votes

I'm trying to set up a navigation system based on the tree node. I've used the example code in the class doc. I cannot get it to show in the node area once the app is run.

Seems I'm missing something. Does someone have a working example? Or some hints

Thanks

in Engine by (124 points)

1 Answer

+2 votes
Best answer

Try this

extends Tree

# class member variables go here, for example:
# var a = 2
# var b = "textvar"

func _ready():
  var root = self.create_item()

  root.set_text(0, 'test')

  var child1 = self.create_item(root)

  child1.set_text(0, 'test-1')

  var child2 = self.create_item(root)

  child2.set_text(0, 'test-2')

  var subchild1 = self.create_item(child1)
  subchild1.set_text(0, "test-3")
by (73 points)
selected by
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.