Extensions methods for the Unity Component class. This also includes some component-related extensions for the GameObject class.
More...
|
| static T | EnsureComponent< T > (this GameObject gameObject) |
| | Ensure that a component of type T exists on the game object. If it doesn't exist, creates it. More...
|
| |
| static T | EnsureComponent< T > (this Component component) |
| | Ensure that a component of type T exists on the game object. If it doesn't exist, creates it. More...
|
| |
| static void | ApplyToHierarchy (this GameObject root, Action< GameObject > action) |
| | Apply the specified delegate to all objects in the hierarchy under a specified game object. More...
|
| |
| static T | FindAncestorComponent< T > (this GameObject gameObject, bool includeSelf=true) |
| | Find the first component of type T in the ancestors of the specified game object. More...
|
| |
| static T | FindAncestorComponent< T > (this Component component, bool includeSelf=true) |
| | Find the first component of type T in the ancestors of the game object of the specified component. More...
|
| |
| static T | FindAncestorComponent< T > (this Transform startTransform, bool includeSelf=true) |
| | Find the first component of type T in the ancestors of the specified transform. More...
|
| |
| static IEnumerable< Transform > | EnumerateAncestors (this Transform startTransform, bool includeSelf) |
| | Enumerates the ancestors of the specified transform. More...
|
| |
| static void | ForEachComponent< T > (this GameObject g, Action< T > action) |
| | Perform an action on every component of type T that is on this GameObject More...
|
| |
Extensions methods for the Unity Component class. This also includes some component-related extensions for the GameObject class.
Definition at line 14 of file ComponentExtensions.cs.
§ ApplyToHierarchy()
| static void HoloToolkit.Unity.ComponentExtensions.ApplyToHierarchy |
( |
this GameObject |
root, |
|
|
Action< GameObject > |
action |
|
) |
| |
|
static |
Apply the specified delegate to all objects in the hierarchy under a specified game object.
- Parameters
-
| root | Root game object of the hierarchy. |
| action | Delegate to apply. |
Definition at line 51 of file ComponentExtensions.cs.
§ EnsureComponent< T >() [1/2]
| static T HoloToolkit.Unity.ComponentExtensions.EnsureComponent< T > |
( |
this GameObject |
gameObject | ) |
|
|
static |
Ensure that a component of type T exists on the game object. If it doesn't exist, creates it.
- Template Parameters
-
- Parameters
-
| gameObject | Game object on which component should be. |
- Returns
- The component that was retrieved or created.
Definition at line 23 of file ComponentExtensions.cs.
§ EnsureComponent< T >() [2/2]
| static T HoloToolkit.Unity.ComponentExtensions.EnsureComponent< T > |
( |
this Component |
component | ) |
|
|
static |
Ensure that a component of type T exists on the game object. If it doesn't exist, creates it.
- Template Parameters
-
- Parameters
-
| component | A component on the game object for which a component of type T should exist. |
- Returns
- The component that was retrieved or created.
Definition at line 41 of file ComponentExtensions.cs.
§ EnumerateAncestors()
| static IEnumerable<Transform> HoloToolkit.Unity.ComponentExtensions.EnumerateAncestors |
( |
this Transform |
startTransform, |
|
|
bool |
includeSelf |
|
) |
| |
|
static |
Enumerates the ancestors of the specified transform.
- Parameters
-
| startTransform | Transform for which ancestors must be returned. |
| includeSelf | Indicates whether the specified transform should be included. |
- Returns
- An enumeration of all ancestor transforms of the specified start transform.
Definition at line 111 of file ComponentExtensions.cs.
§ FindAncestorComponent< T >() [1/3]
| static T HoloToolkit.Unity.ComponentExtensions.FindAncestorComponent< T > |
( |
this GameObject |
gameObject, |
|
|
bool |
includeSelf = true |
|
) |
| |
|
static |
Find the first component of type T in the ancestors of the specified game object.
- Template Parameters
-
| T | Type of component to find. |
- Parameters
-
| gameObject | Game object for which ancestors must be considered. |
| includeSelf | Indicates whether the specified game object should be included. |
- Returns
- The component of type T . Null if it none was found.
Definition at line 67 of file ComponentExtensions.cs.
§ FindAncestorComponent< T >() [2/3]
| static T HoloToolkit.Unity.ComponentExtensions.FindAncestorComponent< T > |
( |
this Component |
component, |
|
|
bool |
includeSelf = true |
|
) |
| |
|
static |
Find the first component of type T in the ancestors of the game object of the specified component.
- Template Parameters
-
| T | Type of component to find. |
- Parameters
-
| component | Component for which its game object's ancestors must be considered. |
| includeSelf | Indicates whether the specified game object should be included. |
- Returns
- The component of type T . Null if it none was found.
Definition at line 79 of file ComponentExtensions.cs.
§ FindAncestorComponent< T >() [3/3]
| static T HoloToolkit.Unity.ComponentExtensions.FindAncestorComponent< T > |
( |
this Transform |
startTransform, |
|
|
bool |
includeSelf = true |
|
) |
| |
|
static |
Find the first component of type T in the ancestors of the specified transform.
- Template Parameters
-
| T | Type of component to find. |
- Parameters
-
| startTransform | Transform for which ancestors must be considered. |
| includeSelf | Indicates whether the specified transform should be included. |
- Returns
- The component of type T . Null if it none was found.
Definition at line 91 of file ComponentExtensions.cs.
§ ForEachComponent< T >()
| static void HoloToolkit.Unity.ComponentExtensions.ForEachComponent< T > |
( |
this GameObject |
g, |
|
|
Action< T > |
action |
|
) |
| |
|
static |
Perform an action on every component of type T that is on this GameObject
- Template Parameters
-
- Parameters
-
| g | this gameObject |
| action | Action to perform. |
Definition at line 130 of file ComponentExtensions.cs.
The documentation for this class was generated from the following file: