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 Here is a link to the SS

I have been trying to access a console node from tree. Clearly node path is correct but godot doesnt get it.

Here is my code:

onready var console = getparent().getnode("Player/CanvasLayer/console")

func physicsprocess(delta):
print(isinstancevalid(console)) <---- dis line keeps outputing false

I think the problem is console isnt in the tree when game launches. its instanced when player presses the console_toggle button. But as you can see when console node is instanced to the scene tree, line i mentioned above still returns false, and when i get rid of /console after canvaslayer it returns true.

Godot version 3.3.4
in Engine by (26 points)
edited by

2 Answers

0 votes
onready var console = getparent().getnode("Player/CanvasLayer/console")


onready var console = getnode("Player/CanvasLayer/console")

try this
or this:

onready var console = getnode("CanvasLayer/console")

depending on context. Try adding "/" in the beginning as well

by (68 points)

Nope, still same error message

nothing is working, is this a bug or something

0 votes

Nevermind i've found the solution. It was very stupid, console node wasnt in the scene tree initialy so i had to get a node to canvaslayer, and then console.get_node("console")

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