what's ^ before the nodePath mean?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jia


^ means /for what?

:bust_in_silhouette: Reply From: Enfyna

It basically tells the engine that this string is a NodePath. If you dont put it yourself then the engine will check if the string is a NodePath then convert the string to NodePath itself. I guess it can give you a very small performance boost if you put it.

:bust_in_silhouette: Reply From: zhyrin

^"text" is a NodePath literal, "text" is a string literal.
get_node() expects a nodepath as a parameter, if you pass a string, it’ll be implicitly converted, but if you pass a nodepath literal, you are explicitly stating the type of parameter the function expects.