Hi
I read that using function “Find” effects on CPU. So, what function I should avoid using it or use it but few times. What thing I should be careful when I use it ?
There’s good optimization talks in Unity youtube, like this one below,
they go through pretty much all of them:
i’ve collected many links for tips here
http://1darray.com/blog/2014/04/23/unity-optimization-tips/
Thank you for the video and the site. But is it true function “Find” effects on CPU ?
Everything you do in scripts will affect performance in some way. The official documentation does mention that Find has a larger effect on performance than most though and shouldn’t be used too often (like every frame).
If you need to reference an object often you should cache the reference to it. An example is shown in the documentation.
https://docs.unity3d.com/ScriptReference/GameObject.Find.html
Now good. ![]()
Thank you.
Run the profiler.
Never used Find while the game is running, only for startup in prototypes.
@Ryiah , as if I weren’t already impressed with your encyclopedic knowledge of game development, you now just demonstrated correct use of both “affect” and “effect” in two sentences.
It’s fortunate for all concerned that I’m happily married. ![]()