0 votes

OneDrive link to screenshot

I've done this successfully before. I have no idea why it's not working now. What's wrong with this?
As you can see from the screenshot, the node path is correct.
I feel like I'm doing something stupid, but I've tried so many times to get this to work. I'm out of ideas.

Thank you for your time.

asked Apr 21, 2019 in Engine by nationality (29 points)

1 Answer

+1 vote
Best answer

Try get_parent().get_parent().get_node("Console");

answered Apr 21, 2019 by GunPoint (392 points)
selected Apr 21, 2019 by nationality

It worked! But damn does that seem inelegant. Godot is strange when it comes to grabbing parent nodes. Wish there was a getroot() method, but it doesn't look like it from the API.
find
parent("TestingGround").get_node("Console") also works.

There are get_tree() and get_root() methods but in earlier godot versions they were not working correctly (at least for me) and i still avoid them. I also avoid the dollar $ sign. I use it only when i need to grab children nodes.
The way I showed you is just logical, you need a child of the parent of the parent :)))

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.