• RuntimesUnityBugs
  • Spine 4.3 beta: Issue importing binary - IndexOutOfRangeException

Problem statement

While importing a spine file with binary into Unity, I encountered the following error:
IndexOutOfRangeException: Index was outside the bounds of the array.
However, importing the same spine with json works fine.

I’ve tried re-importing the spine runtime (via UPM or importing the .unitypackage), but the error persists.
Could this be because 4.3 is still in beta, or is there some setting I need to adjust before exporting the binary?

I also took a look at line 198 in SkeletonBinary.cs, and it seems to be where the inherit value is assigned. I noticed that not every bone in my json file has the inherit property — and since the binary file isn’t human-readable, I’m wondering if that might be something related to the issue?

Runtime information

Unity 2022.3.29f1
Spine-CSharp 4.3.2
Spine-Unity 4.3.1

FILENAME_Atlas :: Imported with 1 material
UnityEngine.Debug:Log (object,UnityEngine.Object)
Spine.Unity.Editor.AssetUtility:IngestSpineAtlas (UnityEngine.TextAsset,System.Collections.Generic.List`1<string>) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:735)
Spine.Unity.Editor.AssetUtility:ImportSpineContent (string[],System.Collections.Generic.List`1<string>,bool) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:403)
Spine.Unity.Editor.AssetUtility:HandleOnPostprocessAllAssets (string[],System.Collections.Generic.List`1<string>) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:118)
Spine.Unity.Editor.SpineEditorUtilities:OnPostprocessAllAssets (string[],string[],string[],string[]) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs:102)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:203)
IndexOutOfRangeException: Index was outside the bounds of the array.
Spine.SkeletonBinary.ReadSkeletonData (System.IO.Stream file) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-csharp@020cd51b96/SkeletonBinary.cs:199)
Spine.Unity.Editor.AssetUtility.AddRequiredAtlasRegionsFromBinary (System.String skeletonDataPath, System.Collections.Generic.List`1[T] requiredPaths) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:224)
Spine.Unity.Editor.AssetUtility.GetRequiredAtlasRegions (System.String skeletonDataPath) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:141)
Spine.Unity.Editor.AssetUtility.ImportSpineContent (System.String[] imported, System.Collections.Generic.List`1[T] texturesWithoutMetaFile, System.Boolean reimport) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:438)
Spine.Unity.Editor.AssetUtility.HandleOnPostprocessAllAssets (System.String[] imported, System.Collections.Generic.List`1[T] texturesWithoutMetaFile) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/AssetUtility.cs:118)
Spine.Unity.Editor.SpineEditorUtilities.OnPostprocessAllAssets (System.String[] imported, System.String[] deleted, System.String[] moved, System.String[] movedFromAssetPaths) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@020cd51b96/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs:102)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f06813fea36f4d329c559563c08ea387>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f06813fea36f4d329c559563c08ea387>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at 
Related Discussions
...

The issue you're encountering with the IndexOutOfRangeException when importing a binary file in Spine 4.3 beta could indeed be related to the beta status of the version. As noted in the context, beta versions, especially early ones, may have unresolved issues and are not recommended for production use. The problem might be due to differences in how the binary format handles properties like "inherit" compared to JSON, which is more human-readable and might handle missing properties more gracefully.

To address this, you could try the following steps:

  1. Ensure you are using the latest available version of the Spine 4.3 beta runtime and editor, as updates might have fixed this issue.
  2. If possible, export your skeleton data in JSON format instead of binary, as this format seems to work without issues.
  3. Check if there are any updates or patches available for the Spine 4.3 beta that address this specific issue.

If the problem persists, it might be beneficial to wait for a more stable release of the 4.3 version or revert to a previous stable version if possible.

More information:
Version in json & binary: 4.3.18-beta

@golden1yaki As Spinebot mentioned, the runtimes are not up to date with the Spine Editor yet on 4.3-beta versions. Sorry for the delay, it's a larger set of changes this time.

As this question has been posted on the forum frequently, there will be a warning message in an upcoming Spine Editor version the export dialog reading that runtimes might not be supporting the beta version yet. 🙂

Thank you for the clarification!