[unity] Fixed SkeletonRenderSeparator mesh being broken with slot alpha 0. Closes #2532.

This commit is contained in:
Harald Csaszar 2024-05-21 21:36:25 +02:00
parent aaa9b81628
commit 330e646c08
3 changed files with 15 additions and 2 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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",