The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

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.

in Engine by (37 points)

1 Answer

+1 vote
Best answer

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

by (408 points)
selected by

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.
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 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.