Skip to main content

class ObjectExtensions

(Niantic.Lightship.Maps.ExtensionMethods.ObjectExtensions)

Overview

Extension methods for UnityObject

class ObjectExtensions {
public:
// methods

static bool IsReferenceNull(this UnityObject unityObject);
static bool IsReferenceNotNull(this UnityObject unityObject);
};

Detailed Documentation

Extension methods for UnityObject

Methods

IsReferenceNull

static bool IsReferenceNull(this UnityObject unityObject)

Checks if the reference to a type derived from UnityObject is null. Unity overrides many of the equality and null coalescing and propagation operators to perform lifetime checks of the underlying Unity engine object, so this extension method is a workaround for cases where the desired behavior is just a simple null check. For more information, see this page from JetBrains.

    Parameters:

    unityObject - The Unity Object to check for null

    Returns:

    True if the reference is null

IsReferenceNotNull

static bool IsReferenceNotNull(this UnityObject unityObject)

Checks if the reference to a type derived from UnityObject is not null. Unity overrides many of the equality and null coalescing and propagation operators to perform lifetime checks of the underlying Unity engine object, so this extension method is a workaround for cases where the desired behavior is just a simple null check. For more information, see this page from JetBrains.

    Parameters:

    unityObject - The Unity Object to check for null

    Returns:

    True if the reference is not null