Skip to content

PoolObject

Attach to GameObjects managed by a PoolContainer to handle activation/deactivation lifecycle and self-return logic.

Namespace: Jungle.Objects
Inherits: MonoBehaviour

Overview

PoolObject is the per-instance component for objects in a PoolContainer. It manages its own lifecycle: acquire activates the GameObject, release deactivates it. Optional IProcess hooks run on acquire and release for visual effects or setup. An optional IPoolReturnTrigger allows the object to return itself to the pool automatically.

Properties

Property Type Description
returnTrigger IPoolReturnTrigger Optional trigger that determines when the object returns to the pool.
outOfPoolProcess IProcess Optional process to run when acquired from the pool.
backToPoolProcess IProcess Optional process to run when released back to the pool.

Runtime API

Member Type Description
Pool PoolContainer The pool this object belongs to.
IsAcquired bool Whether this object is currently in use.
OnAcquired event Action<PoolObject> Fired on acquire.
OnReleased event Action<PoolObject> Fired on release.

Methods

Method Description
Acquire(Action) Mark as in-use, activate, arm return trigger, run out-of-pool process.
Release(Action) Return to pool, disarm trigger, run back-to-pool process, deactivate.
ResetState() Virtual method for subclass-specific reset logic.

See Also