Browse Source

[unity] Use EnsureCapacity for predetermined list sizes.

pharan 7 years ago
parent
commit
d78b2fd024

+ 2 - 2
spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SpineMesh.cs

@@ -1469,13 +1469,13 @@ namespace Spine.Unity {
 			this.hasActiveClipping = other.hasActiveClipping;
 			this.rawVertexCount = other.rawVertexCount;
 			this.attachments.Clear(false);
-			this.attachments.GrowIfNeeded(other.attachments.Capacity);
+			this.attachments.EnsureCapacity(other.attachments.Capacity);
 			this.attachments.Count = other.attachments.Count;
 			other.attachments.CopyTo(this.attachments.Items);
 			#endif
 
 			this.submeshInstructions.Clear(false);
-			this.submeshInstructions.GrowIfNeeded(other.submeshInstructions.Capacity);
+			this.submeshInstructions.EnsureCapacity(other.submeshInstructions.Capacity);
 			this.submeshInstructions.Count = other.submeshInstructions.Count;
 			other.submeshInstructions.CopyTo(this.submeshInstructions.Items);
 		}

+ 2 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/SkeletonExtensions.cs

@@ -557,7 +557,8 @@ namespace Spine {
 
 			var drawOrder = skeleton.drawOrder;
 			drawOrder.Clear(false);
-			drawOrder.GrowIfNeeded(n);
+			drawOrder.EnsureCapacity(n);
+			drawOrder.Count = n;
 			System.Array.Copy(slotsItems, drawOrder.Items, n);
 		}