Referencing Node3D doesn't work

Godot Version



I have a scene tree that looks as the following:
| CharacterBody3D
| | Node3D
| | | Camera3D
| Building (Node3D)

I also have script attached to the Camera3D with a variable:

@onready var building = $"/../../../Building"

But it I’m getting an error where the node isn’t found. How do I make it work?

The path you’re using starts with a “/” which means it’s starting on the root, then going three levels up. I think you meant to just go three levels up so $"../../../Building"

But I’d recommend not using relative node tree paths like this when possible. It can be the source of bugs down the line, but for learning it’s fine.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.