GameObjectExtensions.IsComponentRequired<T> 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.
Checks if any MonoBehaviour on the given GameObject is using the RequireComponentAttribute requiring type T
public:
generic <typename T>
where T : UnityEngine::Component[System::Runtime::CompilerServices::Extension]
static bool IsComponentRequired(UnityEngine::GameObject ^ gameObject, [Runtime::InteropServices::Out] System::Collections::Generic::List<Type ^> ^ % requiringTypes);
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
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