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

◆ In() [2/3]

static bool Sisus.Init.Find.In ( [DisallowNull] object obj,
[DisallowNull] Type type,
[NotNullWhen(true), MaybeNullWhen(false)] out object result )
static

Finds object of type T by searching obj .

If obj is of type T , derives from type T or implements an interface of type T , then returns obj as T .

If obj is a GameObject then the GameObject is searched for a Component which is of type T , derives from type T or implements an interface of type T .

If obj is a Component or wrapped by a Wrapper component then the GameObject to which the Component is attached to is searched for a Component which is of type T , derives from type T or implements an interface of type T .

Parameters
objThe object to search.
typeType of the object to find.

Objects match the search criteria if their class is of this type, if their class derives from a base class of this type, or their class implements an interface of this type.

Only objects whose classes derive from Component or objects that are wrapped by a IWrapper<T> can be found.

Parameters
resultWhen this method returns, contains object of type T , if found; otherwise, null. This parameter is passed uninitialized.
Returns
true if object of the given type was found; otherwise, false.