Node not found error using get_node(). how to solve?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RockyXDeadman

this is my res:// :


i am trying to get my players position in goblin.tscn script using :

onready var playerpos = get_node(“…/root/player/player”) but it gives node not found error.

how to solve this error?


:bust_in_silhouette: Reply From: exuin

The get_node() function needs a node path based on the layout of the nodes in the scene, not in your res:// directory. Look out how the nodes are laid out in the “Scene” tab, not the “FileSystem” tab.

For example, if your scene had a node hierarchy like this:

  • Main
  • Goblin
  • Player

Your node path would be “…/Player”.

:bust_in_silhouette: Reply From: vnmk8

what is your node structure? if you have both nodes as siblings in the node tree you can access the root node of the scene and then reference the player node

var player = get_parent().get_node("player")