From 43565f197dade491a816cfab88bc440af7460ef2 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 9 Jul 2021 18:36:10 +0200 Subject: [PATCH] [unity] Fixed incorrect rendering when `CanvasGroup compatible` is enabled on `SkeletonGraphic TintBlack` shader. Closes #1908. --- .../Runtime/spine-unity/Mesh Generation/MeshGenerator.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs index 1b1df877e..d8a4e178e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs @@ -566,7 +566,8 @@ namespace Spine.Unity { float tintBlackAlpha = 1.0f; if (pmaVertexColors) { - color.a = (byte)(skeletonA * slot.a * c.a * 255); + float colorA = skeletonA * slot.a * c.a; + color.a = (byte)(colorA * 255); color.r = (byte)(skeletonR * slot.r * c.r * color.a); color.g = (byte)(skeletonG * slot.g * c.g * color.a); color.b = (byte)(skeletonB * slot.b * c.b * color.a); @@ -576,6 +577,9 @@ namespace Spine.Unity { else color.a = 0; } + else if (canvasGroupTintBlack) { // other blend modes + tintBlackAlpha = colorA; + } } else { color.a = (byte)(skeletonA * slot.a * c.a * 255); color.r = (byte)(skeletonR * slot.r * c.r * 255);