diff --git a/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs b/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs index efa9c180b..748417435 100644 --- a/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs +++ b/spine-unity/Assets/spine-unity/Editor/SpineAttributeDrawers.cs @@ -254,8 +254,15 @@ namespace Spine.Unity.Editor { ISkeletonComponent skeletonComponent = GetTargetSkeletonComponent(property); var validSkins = new List(); + + if (skeletonComponent != null && targetAttribute.currentSkinOnly) { - var currentSkin = skeletonComponent.Skeleton.Skin; + Skin currentSkin = null; + + var skinProperty = property.FindPropertyRelative(targetAttribute.skinField); + if (skinProperty != null) currentSkin = skeletonComponent.Skeleton.Data.FindSkin(skinProperty.stringValue); + + currentSkin = currentSkin ?? skeletonComponent.Skeleton.Skin; if (currentSkin != null) validSkins.Add(currentSkin); else diff --git a/spine-unity/Assets/spine-unity/SpineAttributes.cs b/spine-unity/Assets/spine-unity/SpineAttributes.cs index 4305bdd73..50693ce0b 100644 --- a/spine-unity/Assets/spine-unity/SpineAttributes.cs +++ b/spine-unity/Assets/spine-unity/SpineAttributes.cs @@ -114,6 +114,7 @@ namespace Spine.Unity { public bool returnAttachmentPath = false; public bool currentSkinOnly = false; public bool placeholdersOnly = false; + public string skinField = ""; public string slotField = ""; /// @@ -127,12 +128,13 @@ namespace Spine.Unity { /// Valid types are SkeletonDataAsset and SkeletonRenderer (and derivatives) /// If left empty and the script the attribute is applied to is derived from Component, GetComponent() will be called as a fallback. /// - public SpineAttachment (bool currentSkinOnly = true, bool returnAttachmentPath = false, bool placeholdersOnly = false, string slotField = "", string dataField = "", bool includeNone = true) { + public SpineAttachment (bool currentSkinOnly = true, bool returnAttachmentPath = false, bool placeholdersOnly = false, string slotField = "", string dataField = "", string skinField = "", bool includeNone = true) { this.currentSkinOnly = currentSkinOnly; this.returnAttachmentPath = returnAttachmentPath; this.placeholdersOnly = placeholdersOnly; this.slotField = slotField; - this.dataField = dataField; + this.dataField = dataField; + this.skinField = skinField; this.includeNone = includeNone; }