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

I have a MAJOR problem
So, my project has more scenes : game, player, etc
When i want to get acces to something inside the player scene in game's code i wanted to get the player scene
So i did get_node("root/Player")
But it says Node not found root/player
And this happens with normal nodes too (not only with scenes)
Is there any other way that i can get the node "Player" ??

My node structure: (in the game scene)
- -sprites

Nodes in the player scene:
-kinematicBody (its called Player)
- - sprite
- - camera2d
- - collisionshape2d

in Engine by (408 points)
edited by

Show a screenshot of your (expanded) node structure!

I can't show screenshots but i edited the question so you can see the node struct

Try putting a slash before root:


Otherwise you could try this:

var root = get_tree().get_root()

also getnode("..") gives the root (or parent?), so getnode("../Player") should also get you what you want. If the problem is actually with the getnode() function, you can always iterate through children with the getchildren() function.

Please log in or register to answer this question.

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.