Skip to main content

struct PooledObject

(Niantic.Lightship.Maps.ObjectPools.PooledObject)

Overview

A container type that acts as a handle to a live object managed by an ObjectPool<T>

    template &lt;T&gt;
struct PooledObject: IDisposable {
// fields

T Value => _objectPool.GetValue(_id);
bool IsAlive => _objectPool.IsAlive(_id);

// methods

void Dispose();
};

Detailed Documentation

A container type that acts as a handle to a live object managed by an ObjectPool<T>

Fields

Value

T Value => _objectPool.GetValue(_id)

Gets the pooled object's value

IsAlive

bool IsAlive => _objectPool.IsAlive(_id)

Checks whether this PooledObject<T> handle points to an object that's still alive. This can be useful to check before accessing the pooled object through the Value property if this pooled object handle may have been disposed elsewhere.

Methods

Dispose

void Dispose()

Releases this object back to the pool. Accessing the Value property after Dispose is called will throw an ObjectDisposedException.