Created
July 13, 2023 15:18
-
-
Save takazerker/29ead5e4d35ab483bf33e972492df608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine.Pool; | |
public struct PooledListScope<T> : System.IDisposable | |
{ | |
List<T> m_List; | |
public static PooledListScope<T> Get(out List<T> list) | |
{ | |
list = ListPool<T>.Get(); | |
return new PooledListScope<T>() { m_List = list }; | |
} | |
public void Dispose() | |
{ | |
ListPool<T>.Release(m_List); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment