using System; using UnityEngine.Pool; namespace RosettaUI.Utilities { public class ObjectPoolItem : IDisposable where TObject : ObjectPoolItem, new() { private static readonly ObjectPool Pool = new(() => new TObject()); public static TObject GetPooled() => Pool.Get(); protected static void Release(TObject record) => Pool.Release(record); public virtual void Dispose() { Release((TObject)this); } } }