Language
Edit

InterfaceExtensions.TryGetMonoBehaviour<T>(T, MonoBehaviour) Method

Definition

Properly checks an interface for null and returns the UnityEngine.MonoBehaviour implementing it.

public static bool TryGetMonoBehaviour<T>(this T interface, out UnityEngine.MonoBehaviour monoBehaviour) where T : class;
static member TryGetMonoBehaviour : 'T * MonoBehaviour -> bool (requires 'T : null)
<Extension()>
Public Function TryGetMonoBehaviour(Of T As Class) (interface As T, ByRef monoBehaviour As MonoBehaviour) As Boolean

Type Parameters

T

Parameters

interface
T
monoBehaviour
UnityEngine.MonoBehaviour

Returns

true if the implementer of the interface is a UnityEngine.MonoBehaviour and the UnityEngine.MonoBehaviour is not null.

Applies to