Пример #1
0
        public static void DrawFixSpriteSize(SpriteData spriteData)
        {
            if (!SpriteAuditorUtility.CanFixSpriteData(spriteData))
            {
                return;
            }

            GUIStyle button = new GUIStyle(EditorStyles.miniButton)
            {
                fixedWidth = 200
            };

            if (GUILayout.Button("Fix texture Size", button))
            {
                SpriteAuditorUtility.SetBestSizeForTexture(spriteData);
            }
        }
 private static void TryToFixSizeOfSelectedObjects()
 {
     foreach (Object selectedObject in SpriteAuditorUtility.SelectedObjects)
     {
         if (selectedObject is Sprite sprite)
         {
             if (SpriteAuditorWindow.GetWindowInstance().SpriteDatabase
                 .TryGetSpriteDataBySprite(sprite, out SpriteData spriteData))
             {
                 if (SpriteAuditorUtility.CanFixSpriteData(spriteData))
                 {
                     SpriteAuditorUtility.SetBestSizeForTexture(spriteData);
                 }
             }
         }
     }
 }