From 3ae51cb0ec4cee8759657e7193259c6c278adc01 Mon Sep 17 00:00:00 2001 From: pharan Date: Wed, 15 Feb 2017 13:44:13 +0800 Subject: [PATCH] [unity] Fix BoundingBoxFollower release build bug. --- .../BoundingBoxFollower.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs b/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs index 9a71ae8dc..2e5820c12 100644 --- a/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs +++ b/spine-unity/Assets/spine-unity/Modules/BoundingBoxFollower/BoundingBoxFollower.cs @@ -160,25 +160,25 @@ namespace Spine.Unity { } void DisposeColliders () { - #if UNITY_EDITOR var colliders = GetComponents(); if (colliders.Length == 0) return; - if (Application.isPlaying) { - foreach (var c in colliders) { - if (c != null) - Destroy(c); + if (Application.isEditor) { + if (Application.isPlaying) { + foreach (var c in colliders) { + if (c != null) + Destroy(c); + } + } else { + foreach (var c in colliders) + if (c != null) + DestroyImmediate(c); } } else { - foreach (var c in colliders) - if (c != null) - DestroyImmediate(c); + foreach (PolygonCollider2D c in colliders) + if (c != null) + Destroy(c); } - #else - foreach (PolygonCollider2D c in colliderTable.Values) - if (c != null) - Destroy(c); - #endif slot = null; currentAttachment = null;