Returns an object of the given type "nearest" to the client GameObject.
The search for a result is performed in the following order:
-
1. The client GameObject itself.
-
2. All the children of the client.
-
3. All the parents of the client.
-
4. All the children of the hierarchy root of the client.
-
5. All the GameObjects in the same scene with the client.
-
6. All the GameObjects in other scenes.
- Template Parameters
-
| T | Type of the object to find. |
- Parameters
-
| gameObject | The GameObject relative to which the nearest object in the scene hierarchy is returned. |
| result | |
| includeInactive | |
- Returns