Created
August 19, 2017 12:44
-
-
Save dimmduh/15ef0a58c251eaa8fb277ba862228e88 to your computer and use it in GitHub Desktop.
List of textures by atlases made by Unity sprite packer.
This file contains hidden or 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; | |
| using System.Collections.Generic; | |
| using UnityEditor; | |
| using UnityEngine; | |
| namespace IOGames.Utils | |
| { | |
| public class SpritePackerIndex : MonoBehaviour | |
| { | |
| [MenuItem("IO Games/Sprite Packer Index")] | |
| // Use this for initialization | |
| public static void run() | |
| { | |
| var sprites = AssetDatabase.FindAssets("t:Sprite"); | |
| var result = new Dictionary<string, List<string>>(); | |
| foreach (var sprite in sprites) | |
| { | |
| var path = AssetDatabase.GUIDToAssetPath(sprite); | |
| var ti = AssetImporter.GetAtPath(path) as TextureImporter; | |
| var tag = ti.spritePackingTag; | |
| if (!string.IsNullOrEmpty(tag)) | |
| { | |
| if (!result.ContainsKey(tag)) | |
| { | |
| result.Add(tag, new List<string>()); | |
| } | |
| result[tag].Add(path); | |
| } | |
| } | |
| foreach (var item in result) | |
| { | |
| Debug.LogFormat("=====================\nTag: {0}", item.Key); | |
| foreach (var path in item.Value) | |
| { | |
| Debug.LogFormat("--- {0}", AssetDatabase.LoadAssetAtPath<Object>(path)); | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment