Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | munja95 |
Hi guys,
I can’t find the answer to my question anywhere else, so I must ask here.
I am using godot for several weeks and I discover that I can use %{node_name} instead of get_node(node_name).
On a few tutorials, I saw that some tutors use %{node_name} everywhere, but some tutors don’t, they cached value in a variable.
So my question is which is better for performance? Does %{node_name} always translate to get_node(node_name) or is there some cache mechanism like a map where the first time %{node_name} is called it will be cached in the map so the next time it is called node will get from the map?
I don’t think there’s any caching. I vagely remember reading something somewhere that says the optimum thing to do is store $Node in a var, as calling $Node or get_node(“mynode”) involves a lookup each time.
SteveSmith | 2022-12-12 21:01