ComponentExtensions.FindAncestorComponent<T>(Component, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Find the first component of type T
in the ancestors of the game object of the specified component.
public static T FindAncestorComponent<T> (this UnityEngine.Component component, bool includeSelf = true) where T : UnityEngine.Component;
static member FindAncestorComponent : UnityEngine.Component * bool -> 'T (requires 'T :> UnityEngine.Component)
<Extension()>
Public Function FindAncestorComponent(Of T As Component) (component As Component, Optional includeSelf As Boolean = true) As T
Type Parameters
- T
Type of component to find.
Parameters
- component
- UnityEngine.Component
Component for which its game object's ancestors must be considered.
- includeSelf
- Boolean
Indicates whether the specified game object should be included.
Returns
T
The component of type T
. Null if it none was found.