Summary
Tries various search methods in the following order until it finds something:
GameObject.GetComponent(Type),
GameObject.GetComponentsInParent(Type, bool),
GameObject.GetComponentsInChildren(Type, bool),
Resources.FindObjectsOfTypeAll(Type).
In the first group where a component of the correct type is found, if multiple components were found the
one with a name closest to the `nameHint` is chosen.
Syntax
public static Component ProgressiveSearch(GameObject gameObject, Type componentType, string nameHint)
Parameters
| Name |
Type |
Description |
| gameObject |
GameObject |
|
| componentType |
Type |
|
| nameHint |
string |
|
Return Value
| Type |
Description |
| Component |
|