Language
Edit

GameObjectExtensions.IsComponentRequired<T> Method

Definition

Checks if any MonoBehaviour on the given GameObject is using the RequireComponentAttribute requiring type T

public static bool IsComponentRequired<T>(this UnityEngine.GameObject gameObject, out System.Collections.Generic.List<Type> requiringTypes) where T : UnityEngine.Component;
static member IsComponentRequired : UnityEngine.GameObject * List -> bool (requires 'T :> UnityEngine.Component)
<Extension()>
Public Function IsComponentRequired(Of T As Component) (gameObject As GameObject, ByRef requiringTypes As List(Of Type)) As Boolean

Type Parameters

T

The potentially required component

Parameters

gameObject
UnityEngine.GameObject

the GameObject requiring the component

requiringTypes
List<Type>

A list of types that do require the component in question

Returns

true if T appears in any RequireComponentAttribute, otherwise false.

Remarks

Only functions when called within a UNITY_EDITOR context. Outside of UNITY_EDITOR, always returns false.

Applies to