From c7c95588f823625685f7ef18e27b909b4ded41f7 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 17 Nov 2025 21:31:12 +0100 Subject: [PATCH] [unity] Added `SPINE_DISABLE_THREADING` define to disable threaded animation and mesh generation entirely. Set via 'Scripting Define Symbols'. --- CHANGELOG.md | 1 + .../spine-unity/Components/Base/SkeletonAnimationBase.cs | 2 ++ .../Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs | 2 ++ .../Runtime/spine-unity/Components/SkeletonGraphic.Common.cs | 2 ++ .../Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs | 2 ++ .../Runtime/spine-unity/Components/SkeletonRenderer.Common.cs | 2 ++ .../Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs | 2 ++ .../Spine/Runtime/spine-unity/Threading/SkeletonUpdateSystem.cs | 2 ++ spine-unity/Assets/Spine/package.json | 2 +- 9 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb6db1ff..58c919403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -363,6 +363,7 @@ - The same applies to the `TrackEntry.Start`, `Interrupt`, `End`, `Dispose`, `Complete`, and `Event` events. If you need these callbacks to run on the main thread instead of worker threads, you should register them using the corresponding `SkeletonAnimation.MainThreadStart`, `MainThreadInterrupt`, etc. callbacks. Note that this does require a small code change, since these events are **not** automatically unregistered when the `TrackEntry` is removed. You’ll need to handle that manually, typically with logic such as `if (trackEntry.Animation == attackAnimation) ..`. - Added `SkeletonUpdateSystem.Instance.GroupRenderersBySkeletonType` and `GroupAnimationBySkeletonType` properties. Defaults to disabled. Later when smart partitioning is implemented, enabling this parameter might slightly improve cache locality. Until then having it enabled combined with different skeleton complexity would lead to worse load balancing. - Added previously missing editor drag & drop skeleton instantiation option *SkeletonGraphic (UI) Mecanim* combining components `SkeletonGraphic` and `SkeletonMecanim`. + - Added define `SPINE_DISABLE_THREADING` to disable threaded animation and mesh generation entirely, removing the respective code. This define can be set as `Scripting Define Symbols` globally or for selective build profiles where desired. - **Deprecated** diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Base/SkeletonAnimationBase.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Base/SkeletonAnimationBase.cs index a290b3d74..02a029e10 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Base/SkeletonAnimationBase.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Base/SkeletonAnimationBase.cs @@ -43,7 +43,9 @@ #define CONFIGURABLE_ENTER_PLAY_MODE #endif +#if !SPINE_DISABLE_THREADING #define USE_THREADED_ANIMATION_UPDATE +#endif #if !SPINE_AUTO_UPGRADE_COMPONENTS_OFF #define AUTO_UPGRADE_TO_43_COMPONENTS diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs index 951dcbfd8..6fd31c597 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs @@ -35,7 +35,9 @@ #define BUILT_IN_SPRITE_MASK_COMPONENT #endif +#if !SPINE_DISABLE_THREADING #define USE_THREADED_ANIMATION_UPDATE +#endif #if !SPINE_AUTO_UPGRADE_COMPONENTS_OFF #define AUTO_UPGRADE_TO_43_COMPONENTS diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.Common.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.Common.cs index 79efaf370..c36507804 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.Common.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.Common.cs @@ -43,7 +43,9 @@ #define CONFIGURABLE_ENTER_PLAY_MODE #endif +#if !SPINE_DISABLE_THREADING #define USE_THREADED_SKELETON_UPDATE +#endif #if !SPINE_AUTO_UPGRADE_COMPONENTS_OFF #define AUTO_UPGRADE_TO_43_COMPONENTS diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 775ae825b..43c8b45e4 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -35,7 +35,9 @@ #define HAS_CULL_TRANSPARENT_MESH #endif +#if !SPINE_DISABLE_THREADING #define USE_THREADED_SKELETON_UPDATE +#endif #if !SPINE_AUTO_UPGRADE_COMPONENTS_OFF #define AUTO_UPGRADE_TO_43_COMPONENTS diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.Common.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.Common.cs index 418a08d35..420e45f59 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.Common.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.Common.cs @@ -43,7 +43,9 @@ #define CONFIGURABLE_ENTER_PLAY_MODE #endif +#if !SPINE_DISABLE_THREADING #define USE_THREADED_SKELETON_UPDATE +#endif #if !SPINE_AUTO_UPGRADE_COMPONENTS_OFF #define AUTO_UPGRADE_TO_43_COMPONENTS diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs index 9110c8cdb..fc79cc1f6 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs @@ -47,7 +47,9 @@ #define REVERT_HAS_OVERLOADS #endif +#if !SPINE_DISABLE_THREADING #define USE_THREADED_SKELETON_UPDATE +#endif #if !SPINE_AUTO_UPGRADE_COMPONENTS_OFF #define AUTO_UPGRADE_TO_43_COMPONENTS diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Threading/SkeletonUpdateSystem.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Threading/SkeletonUpdateSystem.cs index 01835a357..1aa3debe0 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Threading/SkeletonUpdateSystem.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Threading/SkeletonUpdateSystem.cs @@ -27,8 +27,10 @@ * SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#if !SPINE_DISABLE_THREADING #define USE_THREADED_SKELETON_UPDATE #define USE_THREADED_ANIMATION_UPDATE // requires USE_THREADED_SKELETON_UPDATE enabled +#endif #define READ_VOLATILE_ONCE #if UNITY_2017_3_OR_NEWER diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 7dd1322e7..9ce95f1c6 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 and examples. Spine Examples can be installed via the Samples tab.", - "version": "4.3.29", + "version": "4.3.30", "unity": "2018.3", "author": { "name": "Esoteric Software",