編集

次の方法で共有


TransformExtensions.FindAncestorComponent<T>(Transform, Boolean) Method

Definition

Find the first component of type T in the ancestors of the specified transform.

public static T FindAncestorComponent<T> (this UnityEngine.Transform startTransform, bool includeSelf = true) where T : UnityEngine.Component;
static member FindAncestorComponent : UnityEngine.Transform * bool -> 'T (requires 'T :> UnityEngine.Component)
<Extension()>
Public Function FindAncestorComponent(Of T As Component) (startTransform As Transform, Optional includeSelf As Boolean = true) As T

Type Parameters

T

Type of component to find.

Parameters

startTransform
UnityEngine.Transform

Transform for which ancestors must be considered.

includeSelf
Boolean

Indicates whether the specified transform should be included.

Returns

T

The component of type T. Null if it none was found.

Applies to