Dr.Z

Hello,

I'm using Spine2D 3.6 plugin and unable to run it on Unity 2017.4 .NET 4.6 (runs fine on .NET 3.5).

Error seems to be with loading Atlas:
"Error reading atlas file for atlas asset: FS_White_Atlas
Input string was not in a correct format."

This error seems to driven from the following function:
public virtual Atlas GetAtlas ()


Specifically:
try {
atlas = new Atlas(new StringReader(atlasFile.text), "", new MaterialsTextureLoader(this));
atlas.FlipV();
return atlas;
} catch (Exception ex) {
Debug.LogError("Error reading atlas file for atlas asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace, this);
return null;
}
Is there any workaround for this?
Dr.Z
記事: 6

badlogic

This is less likely an issue with Spine and .NET 4.6, but an issue with the atlas you are trying to load. Could you show the full stack trace so we see where in the Spine Runtime it errors out?
アバター
badlogic

Mario
記事: 1448

Dr.Z

The Atlas I'm trying to load is the one with the default package (3.6 spine-unity). It works perfectly fine on .NET 3.5. The issue occurs when trying to open the project and during runtime (where spine objects are still hidden).



I'm not sure how to get the full trace but hopefully these images are enough (check attachments)







How to re-create the issue:
- Open Unity 2017.4 (didn't try other versions).
- Add Spine-Unity 3.6 package.
- Change run time from .NET 3.5 to 4.6 While on Android target build (didn't try other target builds).
- Reload the editor.
- if no errors come along, run a scene where active spine objects are displayed.
添付ファイル
2.PNG
1.PNG
Dr.Z
記事: 6

Pharan

Thanks for reporting, we'll see what's wrong with it.

---

I tried using the following:
latest spine-unity runtime for Spine 3.6
Unity 2017.4.14f1
restarted with Scripting Runtime Version * Experimental (.NET 4.6 Equivalent)
Added the Footsoldier skeleton (as in your example) to a scene and tried playing.
tried both Android and Standalone targets

No errors. The atlas and skeleton successfully loaded and the skeleton functions correctly.

Do you have a screenshot of your player settings under Other Settings>Configuration (where the scripting runtime version is set)?
Have you tried completely removing the spine runtime and the reimporting it fresh from the unitypackage?
アバター
Pharan

Pharan
記事: 5277

Dr.Z

That's indeed weird, hopefully it's just some misuse from my side then.




Anyways, I started a new Unity "2017.4 14f1" project (configured .NET to 4.6 before importing Spine "3.6 2018-10-18") and the issue seems to persist.


Here is a video I captured, tried to show players settings as well as all errors:

Spine Isuue report - YouTube





Another important video switching from .NET 4.6 to 3.5 and back, how it works perfectly fine on 3.5:
From NET 4 6 to 3 5 - YouTube



Feel free if some useful information aren't provided in the video, I'll make sure to have them reported.
Thanks for the effort
Dr.Z
記事: 6

Pharan

Tracing back from its source of int.Parse, it may have something to do with unusual behavior regarding a system-level setting, like culture settings, which the current Atlas code doesn't specify by default.

This Unity user seems to have run into a similar issue with a separate system (not Spine) : https://gamedev.stackexchange.com/questions/158989/things-to-keep-in-mind-after-upgrading-from-net-3-5-to-net-4-6-on-unity3d

We'll check further.

---

Can you try replacing your Atlas.cs with this code and see if it fixes it for you?
raw: https://gist.githubusercontent.com/pharan/7414f73131939c2987e200ea8f63a36c/raw/5aa313dc65b7ab6cf4b94c52c786abb70e3a0bb7/Atlas.cs

gist: https://gist.github.com/pharan/7414f73131939c2987e200ea8f63a36c
アバター
Pharan

Pharan
記事: 5277

Dr.Z

Hello, sorry for the late response, we were off the project a bit and just came to check the issue.




So I replaced the old Atlas.cs with the provided version. Still Same error (in .NET 4.6) and it works fine in .NET 3.5.



I'd also love to add that we moved the project to Unity 2018.2 .NET 4.6 and it works fine (Without any modification). I'm starting to think if we re-installed Unity 2017.4 it'll work fine. I'll check with that later to report.


Until then, if you've any solution you'd love to try, we're here to help to improve Spine2D.
添付ファイル
1.PNG
Dr.Z
記事: 6

Pharan

It might just be a bug in 2017.4's experimental mono runtime that was fixed in 2018.

We could try to specify int.Parse further. That seems to be what's tripping it up.
Are you using a non-English OS or is your OS using a culture setting that has a different number format? (for example, your numbers have spaces or dots instead of commas?)
アバター
Pharan

Pharan
記事: 5277

Dr.Z

OS is totally english, However, I'm using Arabic words and Numbers in non-unity tasks. I'm not sure if that could affect culture settings, but might be
Dr.Z
記事: 6

badlogic

Culture settings can indeed affect the parsing of things like decimal place delimiter (e.g. "0,000" vs "0.0000"). This settings are usually system wide, and it might be that number parsing routines in .NET are affected by that.

Could you try changing your settings to see if that's the problem?
アバター
badlogic

Mario
記事: 1448


Dr.Z

Yes, this one fixes my issue on Unity 2017.4 .NET 4.6



Thanks
Dr.Z
記事: 6


Return to Unity