• Unity
  • The 4.0 skeleton json output from 4.1 cannot be recognized

I'm using 4.1beta Spine editor and 4.0 unity runtime.
So I select 4.0 when I output my skeleton json file:

Then an error occurs in Unity:

Failed to read version info at skeleton 'Shiro'. It is likely not a valid Spine SkeletonData file.
System.FormatException: Input string was not in the correct format
  at System.Int32.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00012] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:640 
  at System.Int32.Parse (System.String s, IFormatProvider provider) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:208 
  at Spine.Unity.SkeletonDataCompatibility.GetVersionInfo (UnityEngine.TextAsset asset, System.Boolean& isSpineSkeletonData, System.String& problemDescription) [0x00230] in E:\git\unity\Shiro\Assets\Spine\Runtime\spine-unity\Asset Types\SkeletonDataCompatibility.cs:154 

And the SkeletonData shows an error too:

After modifying the Version in the json file from "4.0-from-4.1.26-beta" to "4.0.64", the error goes away and everything runs well.

I think the error occurs because the version string ("4.0-from-4.1.26-beta") does not fit the Regex in the SkeletonDataCompatibility.cs:

static readonly Regex jsonVersionRegex = new Regex(@[quote]spine""\s[i]:\s[/i]""([^""]+)[/quote], RegexOptions.CultureInvariant);

Hope this will help you fix the bug!

Related Discussions
...
  • Изменено

咦?看我发现了谁

titidatiti написал

I'm using 4.1beta Spine editor and 4.0 unity runtime.

Spine can export JSON that is compatible with an older version, but doing this can (and usually does) result in data loss. That means you could lose curves for keys (eg when going from 4.0+ to <= 3.8) or features from the newer editor that don't exist in the older version.

When exporting older JSON, the version in the JSON file is something like "4.0-from-4.1.26-beta". That version isn't recognized by the runtime as "4.0.xx" and so the runtime will give a warning or possibly an error. This is because exporting older JSON is primarily for exporting back into an older version of Spine, not for giving to a runtime. The data likely lost some features, it needs to be reviewed and should be exported from the older version of Spine before using it with the matching runtime.

You should use the version of the runtime that matches the editor version you export from:
Versioning - Spine User Guide: Synchronizing versions

In your case that means you should just use the 4.1 runtime and export the data for 4.1.

месяц спустя
Nate написал
titidatiti написал

I'm using 4.1beta Spine editor and 4.0 unity runtime.

Spine can export JSON that is compatible with an older version, but doing this can (and usually does) result in data loss. That means you could lose curves for keys (eg when going from 4.0+ to <= 3.8) or features from the newer editor that don't exist in the older version.

When exporting older JSON, the version in the JSON file is something like "4.0-from-4.1.26-beta". That version isn't recognized by the runtime as "4.0.xx" and so the runtime will give a warning or possibly an error. This is because exporting older JSON is primarily for exporting back into an older version of Spine, not for giving to a runtime. The data likely lost some features, it needs to be reviewed and should be exported from the older version of Spine before using it with the matching runtime.

You should use the version of the runtime that matches the editor version you export from:
Versioning - Spine User Guide: Synchronizing versions

In your case that means you should just use the 4.1 runtime and export the data for 4.1.

Thank you for your explanation and I'm sorry for replying late.
Yes, the JSON with version "4.0-from-4.1.26-beta" may cause data loss, but actually it can run well in runtime 4.0.
So I think the GetVersionInfo function in SkeletonDataCompatibility.cs should return the version '4.0' rather than post a failure notice.Otherwise even when the JSON works well, users cannot modify the Mix Settings. :think:

Failure message:

Изображение удалено из-за отсутствия поддержки HTTPS. | Показать

Better result:

In my situation, I modified the script like this to make the Mix Settings usable:

            
// Modified for Mix Settings capability var versionConverterStr = (fileVersion.rawVersion.Split('-'))[0]; // Converted version string is like x.x-from-y.y.y, we only need the string before '-' var versionSplit = versionConverterStr.Split('.'); /* var versionSplit = fileVersion.rawVersion.Split('.'); */

Maybe there is a better way which can show the warning and keep the Mix Settings usable. 🙂

titidatiti написал

the JSON with version "4.0-from-4.1.26-beta" may cause data loss, but actually it can run well in runtime 4.0.

There may not be data loss for 4.0 to 4.1 (I would need to check, at least sequences are lost), but it's somewhat of a coincidence and likely there will be data loss for other versions.

titidatiti написал

Otherwise even when the JSON works well, users cannot modify the Mix Settings.

It sounds reasonable that the version warning should not prevent using the UI.

The problem here is if 4.1 doesn't work we try to export to 4.0 to be able to work and it's not recognized so sure we should use the corresponding package but if the package does not work we are stuck. Can reopen the project in previous versions of Spine and cannot also export to previous version of packages. What are we suppose to do?

@martindnastudios You can find the way to roll back a Spine project saved in 4.1 so that it can be opened in Spine 4.0 or earlier in the following thread:
4.1.04 FFD keys breaking glitch

If you are not using any of the new features added in 4.1, e.g. sequence attachments, you should be able to roll back without any problems. If you run into any problems, please let us know!

I'm not sure what you mean by 4.1 not working? Everything should work. If something in 4.1 doesn't work, let us know and we'll fix it ASAP!

Thanks for your quick answers 🙂

Misaki написал

@[удалено] You can find the way to roll back a Spine project saved in 4.1 so that it can be opened in Spine 4.0 or earlier in the following thread:
4.1.04 FFD keys breaking glitch

Thanks a lot! Will look into it

Nate написал

I'm not sure what you mean by 4.1 not working? Everything should work. If something in 4.1 doesn't work, let us know and we'll fix it ASAP!

It's probably something I am doing wrong or on my machine but I am running in some issue importing my files. I wrote abotu the problem in this thread : Unity 2021.3.6f1 importation issue