• RuntimesUnity
  • Swapping atlases based on screen resolution

I have done some more work on this and everything seems to be working perfectly in both the build and in the editor, apart from the error that gets thrown when running the build (mentioned above).

As soon as I have a skeleton data asset with an empty atlas list then I get the error in the build.

I could just ignore the error but I would much rather fix it.

Related Discussions
...

Glad to hear you've got a working solution already! Sorry for the troubles with the error message, we will check whether we can remove it safely. I'll get back to you here on the forum once we have a fix ready.

@JDBB Unfortunately we could not reproduce the issue, we received no error message when entering play mode or building with a scene which uses a skeleton with the SkeletonDataAsset's Atlas Assets size set to 0.

Which exact version of the spine-unity runtime (name of the unitypackage, also listed in Assets/Spine/version.txt or in the Package Manager) are you using?

The version of the Unity runtime is: 4.2.67
The C Sharp runtime is: 4.2.23
I am using Unity version: 2023.2.20

I did have the addressables and on demand loading packages installed at one point but have since removed them from the project.

@Harald

I have just made a fresh project to test on and I am still seeing the error.

I can send you the project if you would like.

Steps that I took:

  1. Made a new universal 2D project in Unity 2023.2.20
  2. Installed the two spine packages via the package manager
  3. Dragged a spine export into unity, this generated the skeleton data asset
  4. Dragged the skeleton data asset into the starting scene and let it generate the skeleton animation game object
  5. In the inspector for the skeleton data asset I set the atlas assets list count to be 0
  6. Built the project

Hopefully I didn't miss anything.

In case it helps the full error is:

Error reading skeleton JSON file for SkeletonData asset: skeleton_SkeletonData
Error reading attachment: God_Ray_0, skin: default
at Spine.SkeletonJson.ReadSkeletonData (System.IO.TextReader reader) [0x013d8] in .\Library\PackageCache\com.esotericsoftware.spine.spine-csharp@568e5ef049\SkeletonJson.cs:369
at Spine.Unity.SkeletonDataAsset.ReadSkeletonData (System.String text, Spine.AttachmentLoader attachmentLoader, System.Single scale) [0x00017] in .\Library\PackageCache\com.esotericsoftware.spine.spine-unity@568e5ef049\Runtime\spine-unity\Asset Types\SkeletonDataAsset.cs:295
at Spine.Unity.SkeletonDataAsset.GetSkeletonData (System.Boolean quiet) [0x000c4] in .\Library\PackageCache\com.esotericsoftware.spine.spine-unity@568e5ef049\Runtime\spine-unity\Asset Types\SkeletonDataAsset.cs:194
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace () (at C:/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object,UnityEngine.Object)
UnityEngine.Debug:LogError (object,UnityEngine.Object)
Spine.Unity.SkeletonDataAsset:GetSkeletonData (bool) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@568e5ef049/Runtime/spine-unity/Asset Types/SkeletonDataAsset.cs:197)
Spine.Unity.SkeletonRenderer:Initialize (bool,bool) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@568e5ef049/Runtime/spine-unity/Components/SkeletonRenderer.cs:476)
Spine.Unity.SkeletonAnimation:Initialize (bool,bool) (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@568e5ef049/Runtime/spine-unity/Components/SkeletonAnimation.cs:189)
Spine.Unity.SkeletonRenderer:Awake () (at ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@568e5ef049/Runtime/spine-unity/Components/SkeletonRenderer.cs:408)
(Filename: ./Library/PackageCache/com.esotericsoftware.spine.spine-unity@568e5ef049/Runtime/spine-unity/Asset Types/SkeletonDataAsset.cs Line: 197)

I just realised that there may be a misunderstanding.

The error shows when I run the build and the first scene loads, not when entering play mode in the editor or when I build the build.

    JDBB I just realised that there may be a misunderstanding.

    The error shows when I run the build and the first scene loads, not when entering play mode in the editor or when I build the build.

    Thanks for the clarification, I have indeed overlooked this important part!
    (Your reproduction steps list above is also missing "7. Run the built executable and observe the error message in the console" 😉 ).

    We've just improved the error message that is given in this case:

    Shader "Spine/Special/HiddenPass" not found while loading SkeletonDataAsset" with 0 Atlas Assets. Please add this shader to Project Settings - Graphics - Always Included Shaders, or make sure your SkeletonDataAssets all have an AtlasAsset assigned.

    So the issue was just the missing shader which was not found in the built executable which is found in the Unity Editor in play mode.

    A new spine-unity 4.2 unitypackage is available for download:
    https://esotericsoftware.com/spine-unity-download

    Issue ticket URL for later reference:
    EsotericSoftware/spine-runtimes2544

    Yeah, my bad for sure. I should have been more clear. I did try editing my post to add the 7th step after I realised my mistake but it said that I don't have permissions.

    Thanks, I will try adding the shader as suggested.

      Looks like it is working great. Thanks so much for the help 💓

      JDBB No need to apologize, I just found it a funny coincidence 🙂. It's very easy to forget to mention steps, especially those one considers trivial or "clear anyway".

      Very glad to hear it's working well for you now, thanks for getting back to us!