From da7d20c4bc318a7251f32dd2a16b1d1836b7a1d7 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 23 Jan 2026 21:46:11 +0100 Subject: [PATCH] [unity] Fixed compile error on older Unity versions introduced in last commit 1af0805. See #3013. --- .../Spine Examples/Scripts/RaggedySpineboy.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Samples~/Spine Examples/Scripts/RaggedySpineboy.cs b/spine-unity/Assets/Spine/Samples~/Spine Examples/Scripts/RaggedySpineboy.cs index 4ae8eb3ec..67ed72a9a 100644 --- a/spine-unity/Assets/Spine/Samples~/Spine Examples/Scripts/RaggedySpineboy.cs +++ b/spine-unity/Assets/Spine/Samples~/Spine Examples/Scripts/RaggedySpineboy.cs @@ -31,6 +31,10 @@ #define USE_COLLIDER_COMPOSITE_OPERATION #endif +#if UNITY_6000_0_OR_NEWER +#define RIGIDBODY2D_USES_LINEAR_VELOCITY +#endif + using Spine.Unity; using System.Collections; using UnityEngine; @@ -69,7 +73,12 @@ namespace Spine.Unity.Examples { void Launch () { RemoveRigidbody(); ragdoll.Apply(); - ragdoll.RootRigidbody.linearVelocity = new Vector2(Random.Range(-launchVelocity.x, launchVelocity.x), launchVelocity.y); + Vector2 velocity = new Vector2(Random.Range(-launchVelocity.x, launchVelocity.x), launchVelocity.y); +#if RIGIDBODY2D_USES_LINEAR_VELOCITY + ragdoll.RootRigidbody.linearVelocity = velocity; +#else + ragdoll.RootRigidbody.velocity = velocity; +#endif StartCoroutine(WaitUntilStopped()); }