I
I
i__egor2021-10-07 20:04:12
Unity
i__egor, 2021-10-07 20:04:12

Search through transform.Find ray only once?

Is it really better to search through transform.Find("full path to the object") only once and save the link? or you can not take a steam bath if you specify the full path, then the unit will not particularly look for anything, what does this Find do in itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mustGamedev, 2021-10-09
@mustGamedev

This is called caching.
If it is supposed that the object needs to be used more than once, then it is better to assign it in the Start or Awake method and use it further in the script. Rather than looking for and assigning this object every time.
It will be much more productive and smarter, that's all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question