Find the Player in Update, why?

Hi!
Instead of searching the Player GO frame by frame, isn’t it better to search it once during Start or Awake? The distance must be calculated in Update, but I don’t see the point of looking for the GO of the player each time.
:confused:

Yes, I strongly recommend that optimization. You should always cache things that aren’t going to change, and the player’s GO is one of those things. In the remaining courses, we do exactly that in the UI code.

1 Like

Thanks for the reply :smiley:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms