Browse Source

[unity] Fixed TK2D sprite collection rotated region import. See #2113.

Harald Csaszar 3 years ago
parent
commit
5bb43d31a5

+ 5 - 0
spine-unity/Assets/Spine/Runtime/spine-unity/Modules/TK2D/SpriteCollectionAttachmentLoader.cs

@@ -88,6 +88,11 @@ namespace Spine.Unity.TK2D {
 
 			regionWidth = (int)(def.boundsData[1].x / def.texelSize.x);
 			regionHeight = (int)(def.boundsData[1].y / def.texelSize.y);
+			if (regionRotated) {
+				float tempSwap = regionWidth;
+				regionWidth = regionHeight;
+				regionHeight = tempSwap;
+			}
 
 			float x0 = def.untrimmedBoundsData[0].x - def.untrimmedBoundsData[1].x / 2;
 			float x1 = def.boundsData[0].x - def.boundsData[1].x / 2;