I'm having issues pointing to my Camera2D node using the following code. For all the lines below (only one is uncommented at a time), either the Slimes or the MapBottom are able to successfully find the Camera2D node, but no line below works for both of them.
@onready var camera_2d: Camera2D = $"../../Player/Camera2D" # works for Slimes
@onready var camera_2d: Camera2D = $"../Player/Camera2D" # works for MapBottom
@onready var camera_2d: Camera2D = %Player/Camera2D # works for MapBottom
@onready var camera_2d: Camera2D = %Camera2D # works for MapBottom
My MapBottom node and the two Slime nodes both use my killzone script. Given the relative locations of the MapBottom/Slimes to the Camera2D, I think I understand the behavior of the top two lines: the Slimes and the MapBottom are in different levels of the hierarchy, so if I use a relative path, the script will only work for nodes that are at a single specific level of the hierarchy.
However, I don't understand the bottom 2 lines. Why would the unique name only work for MapBottom?