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