From 3cf66670cc02ddd7957cbff55ec5e0741ab80a91 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 14 Jan 2020 18:53:22 +0100 Subject: [PATCH] [unity] Fixed SkinUtilities.GetClonedSkin performing shallow copy at Attachment key. Closes #1599. --- .../Spine/Runtime/spine-unity/Utility/SkinUtilities.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/SkinUtilities.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/SkinUtilities.cs index 0cdcca1dd..7da118298 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/SkinUtilities.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/SkinUtilities.cs @@ -135,12 +135,15 @@ namespace Spine.Unity.AttachmentTools { if (cloneAttachments) { if (overwrite) { - foreach (var e in sourceAttachments) - destinationAttachments[e.Key] = e.Value.GetCopy(cloneMeshesAsLinked); + foreach (var e in sourceAttachments) { + Attachment clonedAttachment = e.Value.GetCopy(cloneMeshesAsLinked); + destinationAttachments[new Skin.SkinEntry(e.Key.SlotIndex, e.Key.Name, clonedAttachment)] = clonedAttachment; + } } else { foreach (var e in sourceAttachments) { if (destinationAttachments.ContainsKey(e.Key)) continue; - destinationAttachments.Add(e.Key, e.Value.GetCopy(cloneMeshesAsLinked)); + Attachment clonedAttachment = e.Value.GetCopy(cloneMeshesAsLinked); + destinationAttachments.Add(new Skin.SkinEntry(e.Key.SlotIndex, e.Key.Name, clonedAttachment), clonedAttachment); } } } else {