using UnityEngine.Pool; namespace UnityEngine.XR.ARFoundation.InternalUtils { interface IReleasable { public void Release(); } static class ObjectPoolCreateUtil { internal static ObjectPool Create(int defaultCapacity = 8, int maxSize = 1024) where T : class, new() { return new ObjectPool( createFunc: () => new T(), actionOnGet: null, actionOnRelease: null, actionOnDestroy: null, collectionCheck: false, defaultCapacity: defaultCapacity, maxSize: maxSize); } internal static ObjectPool CreateWithReleaseTrigger( int defaultCapacity = 8, int maxSize = 1024) where TReleasable : class, IReleasable, new() { return new ObjectPool( createFunc: () => new TReleasable(), actionOnGet: null, actionOnRelease: x => x.Release(), actionOnDestroy: null, collectionCheck: false, defaultCapacity: defaultCapacity, maxSize: maxSize); } } }