[unity] Fixed compile error on older Unity versions introduced in last commit 1af0805. See #3013.

This commit is contained in:
Harald Csaszar 2026-01-23 21:46:11 +01:00
parent 1af080578d
commit da7d20c4bc

View File

@ -31,6 +31,10 @@
#define USE_COLLIDER_COMPOSITE_OPERATION #define USE_COLLIDER_COMPOSITE_OPERATION
#endif #endif
#if UNITY_6000_0_OR_NEWER
#define RIGIDBODY2D_USES_LINEAR_VELOCITY
#endif
using Spine.Unity; using Spine.Unity;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;
@ -69,7 +73,12 @@ namespace Spine.Unity.Examples {
void Launch () { void Launch () {
RemoveRigidbody(); RemoveRigidbody();
ragdoll.Apply(); 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()); StartCoroutine(WaitUntilStopped());
} }