com.wallstop-studios.unity-helpers 2.0.0-rc81.4 → 2.0.0-rc81.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,6 +13,7 @@ namespace WallstopStudios.UnityHelpers.Editor.Sprites
|
|
|
13
13
|
using UnityEditor.U2D;
|
|
14
14
|
using UnityEngine;
|
|
15
15
|
using UnityEngine.U2D;
|
|
16
|
+
using WallstopStudios.UnityHelpers.Utils;
|
|
16
17
|
using Object = UnityEngine.Object;
|
|
17
18
|
|
|
18
19
|
public sealed class ScriptableSpriteAtlasEditor : EditorWindow
|
|
@@ -806,6 +807,29 @@ namespace WallstopStudios.UnityHelpers.Editor.Sprites
|
|
|
806
807
|
platformSettings.textureCompression = config.compression;
|
|
807
808
|
atlas.SetPlatformSettings(platformSettings);
|
|
808
809
|
|
|
810
|
+
int spriteCount = atlas.spriteCount;
|
|
811
|
+
using PooledResource<Sprite[]> spriteResource = WallstopArrayPool<Sprite>.Get(
|
|
812
|
+
spriteCount
|
|
813
|
+
);
|
|
814
|
+
Sprite[] sprites = spriteResource.resource;
|
|
815
|
+
int loaded = atlas.GetSprites(sprites);
|
|
816
|
+
using PooledResource<List<Sprite>> removeResource = Buffers<Sprite>.List.Get();
|
|
817
|
+
List<Sprite> toRemove = removeResource.resource;
|
|
818
|
+
|
|
819
|
+
for (int i = 0; i < loaded; ++i)
|
|
820
|
+
{
|
|
821
|
+
Sprite sprite = sprites[i];
|
|
822
|
+
if (sprite == null)
|
|
823
|
+
{
|
|
824
|
+
toRemove.Add(sprite);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
if (toRemove.Count > 0)
|
|
829
|
+
{
|
|
830
|
+
atlas.Remove(toRemove.ToArray<Object>());
|
|
831
|
+
}
|
|
832
|
+
|
|
809
833
|
Object[] spritesToAdd = config.spritesToPack.Where(s => s != null).ToArray<Object>();
|
|
810
834
|
if (spritesToAdd.Length > 0)
|
|
811
835
|
{
|