Problem Statement
Loading any skeleton binary (.skel.bytes) that contains a Path Constraint with Position Mode set to Percent throws an IndexOutOfRangeException and fails to load entirely.
Steps to reproduce:
- Create a skeleton in Spine Editor with a Path Constraint
- Set Position Mode to Percent in the Path Constraint settings
- Export as binary (.skel)
- Enter Play Mode
- Instantiate a Skeleton Graphic with the SkeletonDataAsset
Expected: Skeleton loads normally.
Actual: Exception thrown during deserialization, skeleton fails to load.
Runtime Information
- Runtime: spine-unity-4.3-2025-10-28-beta.unitypackage, affected file: SkeletonBinary.cs:354
Index has to be between upper and lower bound of the array.
at System.Array.GetValue (System.Int32 index)
at Spine.SkeletonBinary.ReadSkeletonData (System.IO.Stream file) [0x0091d] in SkeletonBinary.cs:354
Root Cause & Fix
In the CONSTRAINT_PATH case, the bitmask extracting positionMode is & 2. When Percent mode is encoded (bit = 1), (flags >> 1) & 2 returns 2 instead of the correct index 1, which is out of bounds for PositionMode's two-value array. Fixed mode (bit = 0) returns 0 either way, so it never crashes.
// Bug— Percent mode resolves to index 2, out of bounds
.GetValue((flags >> 1) & 2);
// Fixed — Percent mode correctly resolves to index 1
.GetValue((flags >> 1) & 1);