From d78b2fd024141caf74850894b485f11170806d44 Mon Sep 17 00:00:00 2001 From: pharan Date: Thu, 18 Oct 2018 21:35:33 +0800 Subject: [PATCH] [unity] Use EnsureCapacity for predetermined list sizes. --- .../Spine/Runtime/spine-unity/Mesh Generation/SpineMesh.cs | 4 ++-- .../Assets/Spine/Runtime/spine-unity/SkeletonExtensions.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SpineMesh.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SpineMesh.cs index c750a78e65..e779113fc9 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SpineMesh.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SpineMesh.cs @@ -1469,13 +1469,13 @@ public void Set (SkeletonRendererInstruction other) { 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); } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/SkeletonExtensions.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/SkeletonExtensions.cs index 48460214fc..bd4286a51c 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/SkeletonExtensions.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/SkeletonExtensions.cs @@ -557,7 +557,8 @@ public static void SetDrawOrderToSetupPose (this Skeleton skeleton) { var drawOrder = skeleton.drawOrder; drawOrder.Clear(false); - drawOrder.GrowIfNeeded(n); + drawOrder.EnsureCapacity(n); + drawOrder.Count = n; System.Array.Copy(slotsItems, drawOrder.Items, n); }