Create a gist now

Instantly share code, notes, and snippets.

[Unity] UIVerticesPool
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TSKT
{
public static class UIVerticesPool
{
static System.WeakReference verticesBuffer;
public static List<UIVertex> Get()
{
List<UIVertex> result = null;
if (verticesBuffer != null)
{
result = verticesBuffer.Target as List<UIVertex>;
}
if (result == null)
{
result = new List<UIVertex>();
verticesBuffer = new System.WeakReference(result);
}
return result;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment