I am familiar with Unity and so I am confused as to how I reference another object and I can't get a clear answer from any Google search.

As an example, let's say I have two apples in my scene. In Unity you could refence each apple by either adding it in the inspector withpublic Gameobject apple1 or do something like GameObject.Find("apple2")and of course from there I'd be able to to easily reference each object and tell it what I want it to do like destroy(gameobject)

In Godot, I am really confused as to how I can do the same. Any help is much appreciated! (And yes, I am can read GDScript just fine)

There are several ways to do this.

Examples:

$A - references node named "A" that is a child of the current node. get_node("A") - equivalent to above. $A/B - references node B that is a child of A that is a child of the current node. $"../A" - references node A that is a sibling of the current node. $"/root/Main/A" - references node A that is a child of Main, which is the top node of the scene tree.

There's also a find_node() method, but it's less efficient than get_node().

get_node() and find_node() are documented here: https://docs.godotengine.org/en/stable/classes/class_node.html#node

    Beautiful beautiful beautiful. I will try it out later or tomorrow and see how I fare. Thank you so much

    a year later
    10 months later

    DaveTheCoder Thanks for the help! I was confused at first and that's why you may see two replies but one has been deleted... Really helpful!

    2 months later

    Hi! You can also just drag and drop. This is particularly useful for longer names.