Class UnityObjectExtensions
Extension methods for Unity's Object class
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit
Assembly: cs.temp.dll.dll
Syntax
public static class UnityObjectExtensions
Methods
DestroyObject(Object, Single)
Destroys a Unity object appropriately depending if running in edit or play mode.
Declaration
public static void DestroyObject(object obj, float t = 0F)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Unity object to destroy |
Single | t | Time in seconds at which to destroy the object, if applicable. |
DontDestroyOnLoad(Object)
Enable Unity objects to skip "DontDestroyOnLoad" when editor isn't playing so test runner passes.
Declaration
public static void DontDestroyOnLoad(this object target)
Parameters
Type | Name | Description |
---|---|---|
Object | target |
IsNull<T>(T)
Tests if an interface is null, taking potential UnityEngine.Object derived class implementers into account which require their overridden operators to be called
Declaration
public static bool IsNull<T>(this T interface)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | interface |
Returns
Type | Description |
---|---|
Boolean | True if either the managed or native object is null, false otherwise |
Type Parameters
Name | Description |
---|---|
T |
TryGetMonoBehaviour<T>(T, out MonoBehaviour)
Properly checks an interface for null and returns the MonoBehaviour implementing it
Declaration
public static bool TryGetMonoBehaviour<T>(this T interface, out MonoBehaviour monoBehaviour)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | interface | |
MonoBehaviour | monoBehaviour |
Returns
Type | Description |
---|---|
Boolean | True if the implementer of the interface is not a MonoBehaviour or the MonoBehaviour is null |
Type Parameters
Name | Description |
---|---|
T |