Hi everybody,
I wanted to know if I will save loading time if I avoid to use Gameobject.Find in Start function and use public variable instead ?
Anyone experienced this ?
Thanks
Hi everybody,
I wanted to know if I will save loading time if I avoid to use Gameobject.Find in Start function and use public variable instead ?
Anyone experienced this ?
Thanks
As far as I know Gameobject.Find might be slow depending on the amount of GameObjects in your scene.
That´s why I avoid it and assign it to a public variable once.
Thanks,
I have 10.000 gameobject in my scene and around 2.500 active so I will probably see the difference ^^, thanks !
And having a lot of public variable instead of " GameObject.find " can hit performance or loading time ?
Because if I want to replace all my " GameObject.find ", I have to create around 200 public variable
And about public static variable, Is it still efficient to create a public variable to create the reference like this (always in order to replace " GameObject.find ") :
public static GameObject example;
public GameObject exampleGo;
void Start () {
example = exampleGo
}
thanks