Init(args)
Scripting Reference
Loading...
Searching...
No Matches
Sisus.Init.Find Class Reference

Description

Utility class for finding instances in the scene.

Supports finding components by their type, any derived type as well as the type of any interface they implement.

Also supports finding wrapped objects in the scene.

Also supports finding components from inactive GameObjects.

Static Public Member Functions

static T Any< T > (bool includeInactive=false)
 Returns the first loaded object of type T type.
 
static bool Any< T > ([NotNullWhen(true), MaybeNullWhen(false)] out T result, bool includeInactive=false)
 Returns the first loaded object of type T type.
 
static bool Any ([DisallowNull] Type type, [NotNullWhen(true), MaybeNullWhen(false)] out object result, bool includeInactive=false)
 Returns the first loaded object of type T type.
 
static object Any ([DisallowNull] Type type, bool includeInactive=false)
 Returns the first loaded object of the given type .
 
static T Any< T > ([DisallowNull] Predicate< T > match, bool includeInactive=false)
 
static bool Any< T > ([DisallowNull] Predicate< T > match, [NotNullWhen(true), MaybeNullWhen(false)] out T result, bool includeInactive=false)
 
static object[] All ([DisallowNull] Type type, bool includeInactive=false)
 Returns all loaded Objects of the given type .
 
static T[] All< T > ([DisallowNull] Predicate< T > match, bool includeInactive=false)
 
static void All< T > ([DisallowNull] Predicate< T > match, [DisallowNull] List< T > results, bool includeInactive=false)
 
static T[] All< T > (bool includeInactive=false)
 
static void All< T > ([DisallowNull] List< T > results, bool includeInactive=false)
 Returns all loaded objects of type T .
 
static void All< T > ([DisallowNull] Type type, [DisallowNull] List< T > results, bool includeInactive=false)
 Returns all loaded objects of the given type .
 
static bool InParents< T > ([DisallowNull] GameObject gameObject, [NotNullWhen(true), MaybeNullWhen(false)] out T result, bool includeInactive=false)
 Finds object of type T by searching the gameObject and all of its parent GameObjects, including grandparents.
 
static T InParents< T > ([DisallowNull] GameObject gameObject, bool includeInactive=false)
 Finds object of type T by searching the gameObject and all of its parent GameObjects, including grandparents.
 
static bool InParents ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, [NotNullWhen(true), MaybeNullWhen(false)] out object result, bool includeInactive=false)
 Returns all objects of the given type attached the GameObject or any of its parents.
 
static object InParents ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, bool includeInactive=false)
 Returns all objects of the given type attached the GameObject or any of its parents.
 
static T[] AllInParents< T > ([DisallowNull] GameObject gameObject, bool includeInactive=false)
 
static object[] AllInParents ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, bool includeInactive=false)
 Returns all components of the given type attached to the gameObject or any GameObject in its parent chain.
 
static void AllInParents< T > ([DisallowNull] GameObject gameObject, [DisallowNull] List< T > results, bool includeInactive=false)
 Returns all components of the given type attached to the gameObject or any GameObject in its parent chain.
 
static void AllInParents< T > ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, [DisallowNull] List< T > results, bool includeInactive=false)
 Returns all components of the given type attached to the gameObject or any GameObject in its parent chain.
 
static T InChildren< T > ([DisallowNull] GameObject gameObject, bool includeInactive=false)
 Finds object of type T by searching the gameObject and all of its child GameObjects, including grandchildren.
 
static bool InChildren< T > ([DisallowNull] GameObject gameObject, [NotNullWhen(true), MaybeNullWhen(false)] out T result, bool includeInactive=false)
 Finds object of type T by searching the gameObject and all of its child GameObjects, including grandchildren.
 
static object InChildren ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, bool includeInactive=false)
 Finds object of the given type by searching the gameObject and all of its child GameObjects, including grandchildren.
 
static T[] AllInChildren< T > ([DisallowNull] GameObject gameObject, bool includeInactive=false)
 
Returns
Array of zero or more objects of type T .

 
static void AllInChildren< T > ([DisallowNull] GameObject gameObject, [DisallowNull] List< T > results, bool includeInactive=false)
 
Parameters
resultsList into which found instances are added.

 
static void AllInChildren ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, [DisallowNull] List< object > results, bool includeInactive=false)
 
Parameters
resultsList into which found instances are added.

 
static object[] AllInChildren ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, bool includeInactive=false)
 
Returns
Array of zero or more objects of the given type .

 
static GameObject WithTag (string tag, bool includeInactive=false)
 Returns the first loaded GameObject with the provided tag , if any.
 
static bool WithTag ([DisallowNull] string tag, [NotNullWhen(true), MaybeNullWhen(false)] out GameObject result, bool includeInactive=false)
 Returns the first loaded GameObject with the provided tag , if any.
 
static T WithTag< T > (string tag, bool includeInactive=false)
 Returns object of type T from the first loaded GameObject with the provided tag , if any.
 
static object WithTag ([DisallowNull] string tag, [DisallowNull] Type type, bool includeInactive=false)
 Returns object of type T from the first loaded GameObject with the provided tag , if any.
 
static GameObject[] AllWithTag (string tag, bool includeInactive=false)
 Returns all loaded GameObjects with the provided tag .
 
static void Components< T > ([DisallowNull] List< T > results, bool includeInactive=false)
 Returns all loaded Components that are of type T or implement an interface of type T or wrap an object of type T .
 
static GameObject GameObjectWith< T > (bool includeInactive=false)
 Returns GameObject containing the first loaded Component that is of type T or implements an interface of type T .
 
static GameObject GameObjectOf< T > ([DisallowNull] T attachedObject)
 Returns GameObject to which the given object is attached.
 
static GameObject GameObjectOf ([DisallowNull] object attachedObject)
 Returns GameObject to which the given object is attached.
 
static bool GameObjectOf ([DisallowNull] object attachedObject, [NotNullWhen(true), MaybeNullWhen(false)] out GameObject gameObject)
 Gets the GameObject to which the given object is attached.
 
static TWrapped WrappedObject< TWrapper, TWrapped > (bool includeInactive=false)
 Returns the first object of type TWrapped wrapped by a loaded Object of type TWrapper .
 
static TWrapped WrappedObject< TWrapped > (bool includeInactive=false)
 Returns the first object that is of type TWrapped or implements an interface of type TWrapped and is wrapped by an a loaded Object that implements IWrapper.
 
static object WrappedObject ([DisallowNull] Type type, bool includeInactive=false)
 Returns the first object that is of the given type or implements an interface of the given type and is wrapped by an active loaded component of type WrapperOf<>.
 
static void AllWrappedObjects< TWrapped > (List< TWrapped > results, bool includeInactive=false)
 Returns all objects of type TWrapped wrapped by active loaded components of type Init.Wrapper<TWrapped>.
 
static TWrapper WrapperOf< TWrapper, TWrapped > ([DisallowNull] TWrapped wrapped)
 Returns the Object which wraps the wrapped object.
 
static IWrapper< TWrapped > WrapperOf< TWrapped > ([DisallowNull] TWrapped wrapped)
 Returns the Object which wraps the wrapped object.
 
static bool WrapperOf< TWrapped > ([DisallowNull] TWrapped wrapped, [NotNullWhen(true), MaybeNullWhen(false)] out IWrapper< TWrapped > result)
 Returns the Object which wraps the wrapped object.
 
static IWrapper WrapperOf ([DisallowNull] object wrapped)
 Returns the component which wraps the wrapped .
 
static bool WrapperOf ([DisallowNull] object wrapped, [NotNullWhen(true), MaybeNullWhen(false)]out IWrapper result, bool includeInactive=false)
 Returns the component which wraps the wrapped .
 
static IWrapper Wrapper< TWrapped > (bool includeInactive=false)
 Returns component which wraps an object of type TWrapped .
 
static IWrapper Wrapper ([DisallowNull] Type type, bool includeInactive=false)
 Returns component which wraps an object of the provided type .
 
static IWrapper< TWrapped >[] AllWrappers< TWrapped > (bool includeInactive=false)
 Returns all components that wrap objects of type TWrapped .
 
static object In ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, Including including)
 Finds object of the given type in relation to the provided gameObject .
 
static bool In< T > ([DisallowNull] GameObject gameObject, [NotNullWhen(true), MaybeNullWhen(false)] out T result, Including including)
 Finds object of the given type in relation to the provided gameObject .
 
static bool In< T > ([DisallowNull] GameObject gameObject, Id id, [NotNullWhen(true), MaybeNullWhen(false)] out T result, Including including)
 Finds object with the given in relation to the provided gameObject .
 
static bool NearestInHierarchy< T > ([DisallowNull] GameObject gameObject, [NotNullWhen(true), MaybeNullWhen(false)] out T result, bool includeInactive=false)
 Returns an object of the given type "nearest" to the client GameObject.
 
static T In< T > ([DisallowNull] object obj)
 Finds object of type T by searching obj .
 
static bool In< T > ([DisallowNull] object obj, [NotNullWhen(true), MaybeNullWhen(false)] out T result)
 Finds object of type T by searching obj .
 
static bool In ([DisallowNull] object obj, [DisallowNull] Type type, [NotNullWhen(true), MaybeNullWhen(false)] out object result)
 Finds object of type T by searching obj .
 
static bool In< T > ([DisallowNull] GameObject gameObject, [NotNullWhen(true), MaybeNullWhen(false)] out T result)
 Finds object of type T by searching the gameObject .
 
static bool In ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, [NotNullWhen(true), MaybeNullWhen(false)] out object result)
 Finds object of type T by searching the gameObject .
 
static T In< T > ([DisallowNull] GameObject gameObject)
 Finds object of type T by searching the gameObject .
 
static T In< T > ([DisallowNull] GameObject gameObject, Including including)
 Finds object of type T in relation to the provided gameObject .
 
static T[] AllIn< T > ([DisallowNull] GameObject gameObject)
 
Returns
Array of zero or more objects of type T .

 
static object[] AllIn ([DisallowNull] GameObject gameObject, [DisallowNull] Type type)
 
Returns
Array of zero or more objects of the given type .

 
static T[] AllIn< T > ([DisallowNull] GameObject gameObject, Including including)
 Finds all objects of type T in relation to the provided gameObject .
 
static object[] AllIn ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, Including including)
 
Returns
Array of zero or more objects of the given type .

 
static void AllIn< T > ([DisallowNull] GameObject gameObject, [DisallowNull] List< T > results)
 
Parameters
resultsList into which found instances are added.

 
static void AllIn< T > ([DisallowNull] GameObject gameObject, [DisallowNull] List< T > results, Including including)
 
Returns
Array of zero or more objects of type T .

 
static void AllIn< T > ([DisallowNull] GameObject gameObject, [DisallowNull] Type type, [NotNull] List< T > results)
 
static bool Resource ([DisallowNull] Type type, [DisallowNull] string path, [NotNullWhen(true), MaybeNullWhen(false)] out object result)
 Loads the asset of the given type stored at path in a Resources folder.
 
static object Resource ([DisallowNull] Type type, [DisallowNull] string path)
 Loads the asset of the given type stored at path in a Resources folder.
 
static T Resource< T > (string path)
 Loads the asset of type T stored at path in a Resources folder.
 
static bool Resource< T > ([DisallowNull] string path, [NotNullWhen(true), MaybeNullWhen(false)] out T result)
 Loads the asset of type T stored at path in a Resources folder.