From 94d8a3a38734bd2f81c764e296118c35cb9eb12a Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 19 Mar 2024 17:46:28 +0100 Subject: [PATCH] [unity] SkeletonGraphic: avoid unnecessary redundant mesh update at color change (necessary after commit c36f847). See #2049. --- .../Editor/Components/SkeletonGraphicInspector.cs | 2 +- .../Runtime/spine-unity/Components/SkeletonGraphic.cs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs index d1b67dd20..4e5a7f433 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs @@ -155,7 +155,7 @@ namespace Spine.Unity.Editor { // MaskableGraphic material = so.FindProperty("m_Material"); - color = so.FindProperty("m_Color"); + color = so.FindProperty("m_SkeletonColor"); raycastTarget = so.FindProperty("m_RaycastTarget"); maskable = so.FindProperty("m_Maskable"); diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 6470ac16c..a00f12b19 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -60,6 +60,13 @@ namespace Spine.Unity { public Material multiplyMaterial; public Material screenMaterial; + /// Own color to replace Graphic.m_Color. + [UnityEngine.Serialization.FormerlySerializedAs("m_Color")] + [SerializeField] protected Color m_SkeletonColor = Color.white; + /// Sets the color of the skeleton. Does not call and + /// unnecessarily as Graphic.color would otherwise do. + override public Color color { get { return m_SkeletonColor; } set { m_SkeletonColor = value; } } + [SpineSkin(dataField: "skeletonDataAsset", defaultAsEmptyString: true)] public string initialSkinName; public bool initialFlipX, initialFlipY;