Beispiel #1
0
        public static void ExtractSpritesFromXml()
        {
            Texture2D texture2D     = Selection.activeObject as Texture2D;
            string    texture2DPath = AssetDatabase.GetAssetPath(texture2D);

            string extension = Path.GetExtension(texture2DPath);
            string xmlPath   = $"{texture2DPath.Replace(extension, ".xml")}";

            Debug.Log(xmlPath);
            TextAsset xml = AssetDatabase.LoadAssetAtPath <TextAsset>(xmlPath);

            if (xml == null)
            {
                SpriteExtractorWindow.CreateWindow();
                SpriteExtractorWindow.Window.OpenFromExternalSource(texture2D);
            }
            else
            {
                ExtractFromXml(texture2D, xml);
            }
        }
Beispiel #2
0
 public static void CreateWindow()
 {
     Window = GetWindow <SpriteExtractorWindow>("Sprite Extractor Tool");
     Window.Show();
 }