com.wallstop-studios.unity-helpers 2.0.0-rc74.8 → 2.0.0-rc75

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.
@@ -403,16 +403,15 @@
403
403
  && srcY >= origMinY
404
404
  && srcY <= origMaxY;
405
405
 
406
- if (insideOriginal)
406
+ if (
407
+ insideOriginal
408
+ && 0 <= srcX
409
+ && srcX < width
410
+ && 0 <= srcY
411
+ && srcY < height
412
+ )
407
413
  {
408
- if (0 <= srcX && srcX < width && 0 <= srcY && srcY < height)
409
- {
410
- croppedPixels[destRow + x] = pixels[srcY * width + srcX];
411
- }
412
- else
413
- {
414
- croppedPixels[destRow + x] = Color.clear;
415
- }
414
+ croppedPixels[destRow + x] = pixels[srcY * width + srcX];
416
415
  }
417
416
  else
418
417
  {
@@ -442,7 +441,7 @@
442
441
  importer.ReadTextureSettings(newSettings);
443
442
  Vector2 origPivot = GetSpritePivot(importer);
444
443
  Vector2 origCenter = new(width * origPivot.x, height * origPivot.y);
445
- Vector2 newPivotPixels = origCenter - new Vector2(minX, minY);
444
+ Vector2 newPivotPixels = origCenter - new Vector2(visibleMinX, visibleMinY);
446
445
  Vector2 newPivotNorm = new(
447
446
  cropWidth > 0 ? newPivotPixels.x / cropWidth : 0.5f,
448
447
  cropHeight > 0 ? newPivotPixels.y / cropHeight : 0.5f
@@ -16,6 +16,22 @@
16
16
 
17
17
  public static class SceneHelper
18
18
  {
19
+ public static bool IsSceneLoaded(string sceneNameOrPath)
20
+ {
21
+ for (int i = 0; i < SceneManager.sceneCount; ++i)
22
+ {
23
+ Scene scene = SceneManager.GetSceneAt(i);
24
+ if (
25
+ string.Equals(scene.name, sceneNameOrPath, StringComparison.Ordinal)
26
+ || string.Equals(scene.path, sceneNameOrPath, StringComparison.Ordinal)
27
+ )
28
+ {
29
+ return true;
30
+ }
31
+ }
32
+ return false;
33
+ }
34
+
19
35
  public static string[] GetAllScenePaths(string[] searchFolders = null)
20
36
  {
21
37
  #if UNITY_EDITOR
@@ -68,11 +84,10 @@
68
84
  async () =>
69
85
  {
70
86
  TaskCompletionSource<bool> disposalComplete = new();
71
- UnityMainThreadDispatcher.Instance.RunOnMainThread(
72
- () =>
73
- _ = sceneScope
74
- .DisposeAsync()
75
- .WithContinuation(() => disposalComplete.SetResult(true))
87
+ UnityMainThreadDispatcher.Instance.RunOnMainThread(() =>
88
+ _ = sceneScope
89
+ .DisposeAsync()
90
+ .WithContinuation(() => disposalComplete.SetResult(true))
76
91
  );
77
92
 
78
93
  await disposalComplete.Task;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc74.8",
3
+ "version": "2.0.0-rc75",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -61,6 +61,8 @@
61
61
 
62
62
 
63
63
 
64
+
65
+
64
66
 
65
67
 
66
68