mrtk_developmentreleases/2.0.0releases/2.1.0releases/2.2.0

    Show / Hide Table of Contents

    Class UnityObjectExtensions

    Extension methods for Unity's Object class

    Inheritance
    Object
    UnityObjectExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    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 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.

    DestroyObject(Object, Single)

    Destroys a Unity object appropriately depending if running in 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

    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
    In This Article
    • Methods
      • DestroyObject(Object, Single)
      • DestroyObject(Object, Single)
      • DontDestroyOnLoad(Object)
      • DontDestroyOnLoad(Object)
      • IsNull<T>(T)
      • TryGetMonoBehaviour<T>(T, out MonoBehaviour)
    Back to top Generated by DocFX