using UnityEngine; using UnityEngine.U2D; using System.Collections.Generic; public static class AtlasCache { static Dictionary _cache = new(); public static SpriteAtlas GetAtlas(string atlasPath) { atlasPath=atlasPath.Replace("SLIS","SLID"); if (_cache.TryGetValue(atlasPath, out SpriteAtlas atlas)) return atlas; atlas = Resources.Load(atlasPath); if (atlas != null) _cache[atlasPath] = atlas; else Debug.LogError("Atlas not found: " + atlasPath); return atlas; } public static void ClearCache() { _cache.Clear(); } }