Modifica

Condividi tramite


GameObjectExtensions.ForEachComponent<T> Method

Definition

Perform an action on every component of type T that is on this GameObject

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static void ForEachComponent(UnityEngine::GameObject ^ gameObject, Action<T> ^ action);
public:
generic <typename T>
 where T : UnityEngine::Component[System::Runtime::CompilerServices::Extension]
 static void ForEachComponent(UnityEngine::GameObject ^ gameObject, Action<T> ^ action);
public static void ForEachComponent<T> (this UnityEngine.GameObject gameObject, Action<T> action);
public static void ForEachComponent<T> (this UnityEngine.GameObject gameObject, Action<T> action) where T : UnityEngine.Component;
static member ForEachComponent : UnityEngine.GameObject * Action<'T> -> unit
static member ForEachComponent : UnityEngine.GameObject * Action<'T (requires 'T :> UnityEngine.Component)> -> unit (requires 'T :> UnityEngine.Component)
<Extension()>
Public Sub ForEachComponent(Of T) (gameObject As GameObject, action As Action(Of T))
<Extension()>
Public Sub ForEachComponent(Of T As Component) (gameObject As GameObject, action As Action(Of T))

Type Parameters

T

Component Type

Parameters

gameObject
UnityEngine.GameObject

this gameObject

action
Action<T>

Action to perform.

Applies to