var go = GameObject.Find("NameOfTheObject");
ProsConsEasy to usePerformance degrades along the number of gameobjects in sceneStrings are weak references and suspect to user errors
var go = GameObject.FindGameObjectWithTag("Player");
ProsConsPossible to search both single objects and entire groupsStrings are weak references and suspect to user errors.Relatively fast and efficientCode is not portable as tags are hard coded in scripts.
[SerializeField]
GameObject[] gameObjects;
ProsConsGreat performanceObject collection is staticPortable codeCan only refer to GameObjects from the same scene
ExampleScript script = GameObject.FindObjectOfType<ExampleScript>();
GameObject go = script.gameObject;
FindObjectOfType() returns null if none is found.
ProsConsStrongly typedPerformance degrades along the number of gameobjects needed to evaluatePossible to search both single objects...
Transform tr = GetComponent<Transform>().Find("NameOfTheObject");
GameObject go = tr.gameObject;
Find returns null if none is found
ProsConsLimited, well defined search scopeStrings are weak references