Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jia |
get_node(^“/root/TouchHelper”)
^ means /for what?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jia |
get_node(^“/root/TouchHelper”)
^ means /for what?
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.
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.