Skip to content

Can't find node %PhantomCamera2D #249

Discussion options

You must be logged in to vote

Based on the error output, it says that it's looking for %PhantomCamera2D as a child inside the tile nodes. But because the pcam node is a sibling node, it should just be a case of changing the relative path. This might not be the most concise way of doing it, but you can always assign it in the _ready() method by doing, for example.

var pcam: PhantomCamera2D

func _ready():
  pcam = get_parent().get_node("%PhantomCamera2D")

In the odd chance that there are some instantiation race conditions, you can also verify that the node is ready by using an await signal like so:

func _ready():
  var pcam_temp: PhantomCamera2D = get_parent().get_node("%PhantomCamera2D")

  if not pcam_temp.is_node_ready

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ChildishGiant
Comment options

@ramokz
Comment options

Answer selected by ChildishGiant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants