[unity] Fixed BoundingBoxFollower and BoundingBoxFollowerGraphic ignoring deactivated skin bone. Closes #2836.

This commit is contained in:
Harald Csaszar 2025-05-05 21:30:28 +02:00
parent ff572ec8a4
commit 480a4b18b7
3 changed files with 12 additions and 6 deletions

View File

@ -57,7 +57,7 @@ namespace Spine.Unity {
BoundingBoxAttachment currentAttachment;
string currentAttachmentName;
PolygonCollider2D currentCollider;
bool skinBoneEnabled = true;
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
public readonly Dictionary<BoundingBoxAttachment, string> nameTable = new Dictionary<BoundingBoxAttachment, string>();
@ -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);
}
}
/// <summary>Sets the current collider to match attachment.</summary>
@ -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;

View File

@ -57,7 +57,7 @@ namespace Spine.Unity {
BoundingBoxAttachment currentAttachment;
string currentAttachmentName;
PolygonCollider2D currentCollider;
bool skinBoneEnabled = true;
public readonly Dictionary<BoundingBoxAttachment, PolygonCollider2D> colliderTable = new Dictionary<BoundingBoxAttachment, PolygonCollider2D>();
public readonly Dictionary<BoundingBoxAttachment, string> nameTable = new Dictionary<BoundingBoxAttachment, string>();
@ -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);
}
}
/// <summary>Sets the current collider to match attachment.</summary>

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.102",
"version": "4.2.103",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",