Преглед изворни кода

[unity] Applied similar optimizing changes to 3.8 commit 3fdbf9a0 (changing new List<> allocation to shared static instance).

Harald Csaszar пре 4 година
родитељ
комит
3f9577b5ac
1 измењених фајлова са 2 додато и 3 уклоњено
  1. 2 3
      spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs

+ 2 - 3
spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs

@@ -233,6 +233,7 @@ namespace Spine.Unity.AttachmentTools {
 		static readonly List<AtlasRegion> originalRegions = new List<AtlasRegion>();
 		static readonly List<AtlasRegion> originalRegions = new List<AtlasRegion>();
 		static readonly List<AtlasRegion> repackedRegions = new List<AtlasRegion>();
 		static readonly List<AtlasRegion> repackedRegions = new List<AtlasRegion>();
 		static List<Texture2D>[] texturesToPackAtParam = new List<Texture2D>[1];
 		static List<Texture2D>[] texturesToPackAtParam = new List<Texture2D>[1];
+		static List<Attachment> inoutAttachments = new List<Attachment>();
 
 
 		/// <summary>
 		/// <summary>
 		/// Fills the outputAttachments list with new attachment objects based on the attachments in sourceAttachments,
 		/// Fills the outputAttachments list with new attachment objects based on the attachments in sourceAttachments,
@@ -489,9 +490,7 @@ namespace Spine.Unity.AttachmentTools {
 			newSkin.bones.AddRange(o.bones);
 			newSkin.bones.AddRange(o.bones);
 			newSkin.constraints.AddRange(o.constraints);
 			newSkin.constraints.AddRange(o.constraints);
 
 
-			var originalAttachments = o.Attachments;
-			int attachmentCount = originalAttachments.Count;
-			List<Attachment> inoutAttachments = new List<Attachment>(attachmentCount);
+			inoutAttachments.Clear();
 			foreach (var entry in o.Attachments) {
 			foreach (var entry in o.Attachments) {
 				inoutAttachments.Add(entry.attachment);
 				inoutAttachments.Add(entry.attachment);
 			}
 			}