com.wallstop-studios.unity-helpers 2.0.0-rc73.11 → 2.0.0-rc73.13
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.
package/Editor/SpriteCropper.cs
CHANGED
|
@@ -341,19 +341,20 @@
|
|
|
341
341
|
}
|
|
342
342
|
);
|
|
343
343
|
|
|
344
|
-
if (!hasVisible)
|
|
345
|
-
{
|
|
346
|
-
return null;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
344
|
int cropWidth = maxX - minX + 1;
|
|
350
345
|
int cropHeight = maxY - minY + 1;
|
|
351
346
|
|
|
352
|
-
if (_onlyNecessary && cropWidth == width && cropHeight == height)
|
|
347
|
+
if (_onlyNecessary && (!hasVisible || (cropWidth == width && cropHeight == height)))
|
|
353
348
|
{
|
|
354
349
|
return null;
|
|
355
350
|
}
|
|
356
351
|
|
|
352
|
+
if (!hasVisible)
|
|
353
|
+
{
|
|
354
|
+
cropWidth = 1;
|
|
355
|
+
cropHeight = 1;
|
|
356
|
+
}
|
|
357
|
+
|
|
357
358
|
Texture2D cropped = new(cropWidth, cropHeight, TextureFormat.RGBA32, false);
|
|
358
359
|
Color32[] croppedPixels = new Color32[cropWidth * cropHeight];
|
|
359
360
|
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
using System;
|
|
4
4
|
using Extension;
|
|
5
5
|
using UnityEditor;
|
|
6
|
-
using UnityEditor.SceneManagement;
|
|
7
6
|
using UnityEngine;
|
|
8
7
|
using UnityEngine.SceneManagement;
|
|
9
8
|
using Object = UnityEngine.Object;
|
|
10
|
-
|
|
9
|
+
#if UNITY_EDITOR
|
|
10
|
+
using UnityEditor.SceneManagement;
|
|
11
|
+
#endif
|
|
11
12
|
public static partial class Helpers
|
|
12
13
|
{
|
|
13
14
|
public static T Find<T>(this Object component, string tag, bool log = true)
|
package/package.json
CHANGED