public static void CacheKnowAtlases() { atlasToAllSprites.Clear(); atlasToScale.Clear(); string[] atlasGUIDs = AssetDatabase.FindAssets("t:SpriteAtlas"); for (int i = 0; i < atlasGUIDs.Length; i++) { SpriteAtlas atlas = AssetDatabase.LoadAssetAtPath <SpriteAtlas>(AssetDatabase.GUIDToAssetPath(atlasGUIDs[i])); if (!atlas.IsIncludedInBuild()) { continue; } Sprite[] sprites = atlas.GetAllSprites().Distinct().ToArray(); float scale = 1.0f; if (atlas.isVariant) { if (atlas.TryGetMasterAtlas(out SpriteAtlas masterAtlas)) { sprites = masterAtlas.GetAllSprites().Distinct().ToArray(); } scale = atlas.GetVariantScale(); } atlasToAllSprites.Add(atlas, sprites); atlasToScale.Add(atlas, scale); } hasDataCached = true; }