using System.Collections; using System.Collections.Generic; using UnityEngine; public class TexturePool { public static Dictionary dicTextures; static List removeKeys; static TexturePool() { } void ClearTexture() { } static int MaxTextureCount; public static Texture2D GetTexture(string key) { Texture2D tex = null; if (dicTextures.ContainsKey(key)) { tex = dicTextures[key]; removeKeys.Remove(key); } return tex; } public static void SaveTexture(string key, Texture2D txt) { if (!dicTextures.ContainsKey(key)) { dicTextures.Add(key, txt); } } public static void RemoveTexture(string key) { removeKeys.Add(key); } }