Table of Contents

Self-Contained Object Pool for .NET / Unity

Runtime/System/Poolable.cs   HeaderDoc

(c) 2024 Sator Imaging, Licensed under the MIT License https://github.com/sator-imaging/Unity-Fundamentals

Thread-safe & efficient singly linked list based object pooling.

HOW TO USE

// inherit Poolable<TSelf>
public class MyPooledClass : Poolable<MyPooledClass>
{
    // your code here
}

// `using` to take instance from pool and return it on dispose
using (var x = MyPooledClass.GetInstance())
{
    x.DoSomething();
}

// there is a throw helper function
ThrowIfAlreadyReturnedToPool("error message");