AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
HoloToolkit.Unity.ComponentExtensions Class Reference

Extensions methods for the Unity Component class. This also includes some component-related extensions for the GameObject class. More...

Static Public Member Functions

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...
 

Detailed Description

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.

Member Function Documentation

§ 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
rootRoot game object of the hierarchy.
actionDelegate 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
TType of the component.
Parameters
gameObjectGame object on which component should be.
Returns
The component that was retrieved or created.
Type Constraints
T :Component 

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
TType of the component.
Parameters
componentA component on the game object for which a component of type T should exist.
Returns
The component that was retrieved or created.
Type Constraints
T :Component 

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
startTransformTransform for which ancestors must be returned.
includeSelfIndicates 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
TType of component to find.
Parameters
gameObjectGame object for which ancestors must be considered.
includeSelfIndicates whether the specified game object should be included.
Returns
The component of type T . Null if it none was found.
Type Constraints
T :Component 

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
TType of component to find.
Parameters
componentComponent for which its game object's ancestors must be considered.
includeSelfIndicates whether the specified game object should be included.
Returns
The component of type T . Null if it none was found.
Type Constraints
T :Component 

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
TType of component to find.
Parameters
startTransformTransform for which ancestors must be considered.
includeSelfIndicates whether the specified transform should be included.
Returns
The component of type T . Null if it none was found.
Type Constraints
T :Component 

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
TComponent Type
Parameters
gthis gameObject
actionAction to perform.

Definition at line 130 of file ComponentExtensions.cs.


The documentation for this class was generated from the following file: