From 330e646c0830c3d69c07f7586e40ac5f91fee77a Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 21 May 2024 21:36:25 +0200 Subject: [PATCH] [unity] Fixed SkeletonRenderSeparator mesh being broken with slot alpha 0. Closes #2532. --- .../spine-unity/Mesh Generation/MeshGenerator.cs | 2 ++ .../Mesh Generation/SkeletonRendererInstruction.cs | 13 ++++++++++++- spine-unity/Assets/Spine/package.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) 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 ee83977e2..a9a82ca9b 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 @@ -39,6 +39,8 @@ // Comment out this line to revert to previous behaviour. // You may only need this option disabled when utilizing a custom shader which // uses vertex color alpha for purposes other than transparency. +// +// Important Note: When disabling this define, also disable the one in SkeletonRenderInstruction.cs #define SLOT_ALPHA_DISABLES_ATTACHMENT using System; diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SkeletonRendererInstruction.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SkeletonRendererInstruction.cs index 0f8876d42..4b1c192d0 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SkeletonRendererInstruction.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/SkeletonRendererInstruction.cs @@ -31,6 +31,10 @@ #define SPINE_TRIANGLECHECK // Avoid calling SetTriangles at the cost of checking for mesh differences (vertex counts, memberwise attachment list compare) every frame. //#define SPINE_DEBUG +// Important Note: When disabling this define, also disable the one in MeshGenerator.cs +// For details, see MeshGenerator.cs. +#define SLOT_ALPHA_DISABLES_ATTACHMENT + using System; using System.Collections.Generic; using UnityEngine; @@ -95,7 +99,14 @@ namespace Spine.Unity { Slot[] drawOrderItems = instructionsItems[0].skeleton.DrawOrder.Items; for (int i = 0; i < attachmentCount; i++) { Slot slot = drawOrderItems[startSlot + i]; - if (!slot.Bone.Active) continue; + if (!slot.Bone.Active +#if SLOT_ALPHA_DISABLES_ATTACHMENT + || slot.A == 0f +#endif + ) { + attachmentsItems[i] = null; + continue; + } attachmentsItems[i] = slot.Attachment; } diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 91d5fe3da..067a39953 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.2.64", + "version": "4.2.65", "unity": "2018.3", "author": { "name": "Esoteric Software",