From 9c106ca5f59f913461a952e2bc6f449e4efe33ab Mon Sep 17 00:00:00 2001 From: Vladislav Hristov Date: Sun, 7 Nov 2021 14:26:37 +0200 Subject: [PATCH] Fix skleton mesh "Identifier uniqueness violation" warning To remove the warning a new unique name is created for each mesh, where an index is added after the renderer name. Closes #1973 --- .../spine-unity/Editor/Utility/SpineEditorUtilities.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs index 6b6a01b18..55fb9331b 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs @@ -110,6 +110,7 @@ namespace Spine.Unity.Editor { public static bool SetupSpinePrefabMesh(GameObject g, UnityEditor.AssetImporters.AssetImportContext context) { + Dictionary nameUsageCount = new Dictionary(); bool wasModified = false; var skeletonRenderers = g.GetComponentsInChildren(true); foreach (SkeletonRenderer renderer in skeletonRenderers) { @@ -125,6 +126,12 @@ namespace Spine.Unity.Editor { if (mesh == null) continue; string meshName = string.Format("Skeleton Prefab Mesh \"{0}\"", renderer.name); + if (nameUsageCount.ContainsKey(meshName)) { + nameUsageCount[meshName]++; + meshName = string.Format("Skeleton Prefab Mesh \"{0} ({1})\"", renderer.name, nameUsageCount[meshName]); + } else { + nameUsageCount.Add(meshName, 0); + } mesh.name = meshName; mesh.hideFlags = HideFlags.None; if (context != null)