ExampleScript script = GameObject.FindObjectOfType<ExampleScript>();
GameObject go = script.gameObject;
FindObjectOfType()returnsnullif none is found.
| Pros | Cons |
|---|---|
| Strongly typed | Performance degrades along the number of gameobjects needed to evaluate |
| Possible to search both single objects and entire groups |