XPool
XPool copied to clipboard
[FEATURE] Return API
I would like to have such an API for simpler object return to a pool.
Fluid Syntax
// When an instance is disabled, it is returned to a pool.
var instance = m_Pool.Rent()
.ReturnOnDisable(m_Pool); // Attach OnDisableTrigger
Disposable pattern
var disposable = m_Pool.Rent(out var instance);
// Return to a pool in callbacks such as object completion.
instance.OnCompleted = () => disposable.Dispose();