Topic was automatically imported from the old Question2Answer platform.
Asked By
MyGrandfather
I feel kinda like a noob but I don’t think I understand what $ is when used in examples. I assume it is similar to get_node but idk if it is the exact same. I looked through the documentation to find the answer but they just start using it without explaining.
Basically my question is what does the $ in something like $player mean and do. Also in what way would you want to use the $
As of Godot 3.0, the $ syntax is used to get a specific node, it’s exactly the same as get_node, except that it saves you a couple keystrokes. you would want to always use it instead of get_node.
# using $
$path/to/node.position
# alternatively
$"path/to/node".position
# both are equivalent to
get_node("path/to/node").position
the @ syntax also exists for NodePath, which instead of doing
NodePath("path/to/node/")
// you can do
@"path/to/node"