Init(args)
Scripting Reference
Loading...
Searching...
No Matches

◆ NearestInHierarchy< T >()

static bool Sisus.Init.Find.NearestInHierarchy< T > ( [DisallowNull] GameObject gameObject,
[NotNullWhen(true), MaybeNullWhen(false)] out T result,
bool includeInactive = false )
static

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
TType of the object to find.
Parameters
gameObjectThe GameObject relative to which the nearest object in the scene hierarchy is returned.
result
includeInactive
Returns