From 480a4b18b78e66570c82fbd0ec61094f29e5b5c3 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 5 May 2025 21:30:28 +0200 Subject: [PATCH] [unity] Fixed BoundingBoxFollower and BoundingBoxFollowerGraphic ignoring deactivated skin bone. Closes #2836. --- .../Components/Following/BoundingBoxFollower.cs | 9 ++++++--- .../Components/Following/BoundingBoxFollowerGraphic.cs | 7 +++++-- spine-unity/Assets/Spine/package.json | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs index 7e5bc6210..c762e71da 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollower.cs @@ -57,7 +57,7 @@ namespace Spine.Unity { BoundingBoxAttachment currentAttachment; string currentAttachmentName; PolygonCollider2D currentCollider; - + bool skinBoneEnabled = true; public readonly Dictionary colliderTable = new Dictionary(); public readonly Dictionary nameTable = new Dictionary(); @@ -132,6 +132,7 @@ namespace Spine.Unity { AddCollidersForSkin(skeleton.Skin, slotIndex, colliders, ref requiredCollidersCount); } DisposeExcessCollidersAfter(requiredCollidersCount); + skinBoneEnabled = slot.Bone.Active; if (BoundingBoxFollower.DebugMessages) { bool valid = colliderTable.Count != 0; @@ -210,8 +211,10 @@ namespace Spine.Unity { } void LateUpdate () { - if (slot != null && slot.Attachment != currentAttachment) + if (slot != null && (slot.Attachment != currentAttachment || skinBoneEnabled != slot.Bone.Active)) { + skinBoneEnabled = slot.Bone.Active; MatchAttachment(slot.Attachment); + } } /// Sets the current collider to match attachment. @@ -225,7 +228,7 @@ namespace Spine.Unity { if (currentCollider != null) currentCollider.enabled = false; - if (bbAttachment == null) { + if (bbAttachment == null || !skinBoneEnabled) { currentCollider = null; currentAttachment = null; currentAttachmentName = null; diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs index dcc46b3ea..237b55cc9 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs @@ -57,7 +57,7 @@ namespace Spine.Unity { BoundingBoxAttachment currentAttachment; string currentAttachmentName; PolygonCollider2D currentCollider; - + bool skinBoneEnabled = true; public readonly Dictionary colliderTable = new Dictionary(); public readonly Dictionary nameTable = new Dictionary(); @@ -133,6 +133,7 @@ namespace Spine.Unity { AddCollidersForSkin(skeleton.Skin, slotIndex, colliders, scale, ref requiredCollidersCount); } DisposeExcessCollidersAfter(requiredCollidersCount); + skinBoneEnabled = slot.Bone.Active; if (BoundingBoxFollowerGraphic.DebugMessages) { bool valid = colliderTable.Count != 0; @@ -211,8 +212,10 @@ namespace Spine.Unity { } void LateUpdate () { - if (slot != null && slot.Attachment != currentAttachment) + if (slot != null && (slot.Attachment != currentAttachment || skinBoneEnabled != slot.Bone.Active)) { + skinBoneEnabled = slot.Bone.Active; MatchAttachment(slot.Attachment); + } } /// Sets the current collider to match attachment. diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 6f5192b2e..cc1ebb380 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.102", + "version": "4.2.103", "unity": "2018.3", "author": { "name": "Esoteric Software",