com.wallstop-studios.unity-helpers 2.0.0-rc74.6 → 2.0.0-rc74.7

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.
@@ -363,10 +363,10 @@
363
363
  }
364
364
  else
365
365
  {
366
- minX = Mathf.Max(0, minX - _leftPadding);
367
- minY = Mathf.Max(0, minY - _bottomPadding);
368
- maxX = Mathf.Min(width, maxX + _rightPadding);
369
- maxY = Mathf.Min(height, maxY + _topPadding);
366
+ minX -= _leftPadding;
367
+ minY -= _bottomPadding;
368
+ maxX += _rightPadding;
369
+ maxY += _topPadding;
370
370
  cropWidth = maxX - minX + 1;
371
371
  cropHeight = maxY - minY + 1;
372
372
  }
@@ -388,7 +388,17 @@
388
388
  int destYOffset = y * cropWidth;
389
389
  for (int x = 0; x < cropWidth; ++x)
390
390
  {
391
- croppedPixels[destYOffset + x] = pixels[sourceYOffset + x + minX];
391
+ int sourceIndex = sourceYOffset + x + minX;
392
+ Color32 sourcePixel;
393
+ if (sourceIndex < 0 || pixels.Length <= sourceIndex)
394
+ {
395
+ sourcePixel = Color.clear;
396
+ }
397
+ else
398
+ {
399
+ sourcePixel = pixels[sourceIndex];
400
+ }
401
+ croppedPixels[destYOffset + x] = sourcePixel;
392
402
  }
393
403
  }
394
404
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc74.6",
3
+ "version": "2.0.0-rc74.7",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -60,5 +60,6 @@
60
60
 
61
61
 
62
62
 
63
+
63
64
 
64
65