UnityObjectExtensions.TryGetMonoBehaviour<T>(T, MonoBehaviour) 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.
Properly checks an interface for null and returns the MonoBehaviour implementing it.
public:
generic <typename T>
where T : class[System::Runtime::CompilerServices::Extension]
static bool TryGetMonoBehaviour(T interface, [Runtime::InteropServices::Out] UnityEngine::MonoBehaviour ^ % monoBehaviour);
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 MonoBehaviour and the MonoBehaviour is not null.