-
Notifications
You must be signed in to change notification settings - Fork 0
Component Extension
Caches all components of type T in the specified Component. It searches for both fields and properties within the component, attempting to set their values based on the existing components in the GameObject's hierarchy.
scriptInstance.CacheAllComponents();Attempts to get the component of type T from the specified Component. Returns true if the component is found, otherwise false. The result is stored in the outComponent parameter.
bool success = scriptInstance.TryGetComponent(out T outComponent);Parameters:
-
outComponent: The variable to store the result if the component is found.
Returns:
-
bool:trueif the component is found, otherwisefalse.
Attempts to get the component of type T from the parent of the specified Component. Returns true if the component is found, otherwise false. The result is stored in the outComponent parameter.
bool success = scriptInstance.TryGetComponentInParent(out T outComponent);Parameters:
-
outComponent: The variable to store the result if the component is found.
Returns:
-
bool:trueif the component is found, otherwisefalse.
Attempts to get the component of type T from the children of the specified Component. Returns true if the component is found, otherwise false. The result is stored in the outComponent parameter.
bool success = scriptInstance.TryGetComponentInChildren(out T outComponent);Parameters:
-
outComponent: The variable to store the result if the component is found.
Returns:
-
bool:trueif the component is found, otherwisefalse.