22 lines
625 B
C#
22 lines
625 B
C#
|
|
namespace Pooling
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Interface for objects that can be pooled.
|
|||
|
|
/// Implement this interface on any component that should be managed by an ObjectPool.
|
|||
|
|
/// </summary>
|
|||
|
|
public interface IPoolable
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Called when the object is retrieved from the pool.
|
|||
|
|
/// Use this to reset the object's state.
|
|||
|
|
/// </summary>
|
|||
|
|
void OnSpawn();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Called when the object is returned to the pool.
|
|||
|
|
/// Use this to clean up any resources or state.
|
|||
|
|
/// </summary>
|
|||
|
|
void OnDespawn();
|
|||
|
|
}
|
|||
|
|
}
|