Click or drag to resize

ColliderExtensionsGetComponentFromColliderOrAnyParentT Method

Gets the named component from the collider's gameobject or any parent of the collider. Uses GetComponentInParentRecursive internally, so calling this many times per frame can have a performance impact.

Namespace:  ImmerseSDK.Extensions
Assembly:  ImmerseSDK.App (in ImmerseSDK.App.dll) Version: 3.9.0.0 (3.9.0.0)
Syntax
C#
public static T GetComponentFromColliderOrAnyParent<T>(
	this UnityEngine.Collider collider
)
where T : UnityEngine.MonoBehaviour

Parameters

collider
Type: UnityEngine.Collider

Type Parameters

T

Return Value

Type: T

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type UnityEngine.Collider. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also