diff --git a/spine-csharp/src/ExposedList.cs b/spine-csharp/src/ExposedList.cs index 9bec2297a..7d0b69711 100644 --- a/spine-csharp/src/ExposedList.cs +++ b/spine-csharp/src/ExposedList.cs @@ -141,6 +141,23 @@ namespace Spine { } } + // Additional overload provided because ExposedList only implements IEnumerable, + // leading to sub-optimal behavior: It grows multiple times as it assumes not + // to know the final size ahead of insertion. + public void AddRange (ExposedList list) { + CheckCollection(list); + + int collectionCount = list.Count; + if (collectionCount == 0) + return; + + GrowIfNeeded(collectionCount); + list.CopyTo(Items, Count); + Count += collectionCount; + + version++; + } + public void AddRange (IEnumerable collection) { CheckCollection(collection); diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs index b5371e031..64cb5ead9 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs @@ -324,6 +324,8 @@ namespace Spine.Unity.AttachmentTools { var skinAttachments = o.Attachments; var newSkin = new Skin(newName); + newSkin.bones.AddRange(o.bones); + // Use these to detect and use shared regions. var existingRegions = new Dictionary(); var regionIndexes = new List();