- Edited
Error reading Skeleton JSON file in Unity.
Hi.
We are trying to integrate the anims made in Spine into Unity with my team. And it works with your examples but not with our anims... Now we're going in circles without finding the solution so I'll come back to you.
Here are some screens of the mistakes we get and my export settings.
We tried with a quickly made animation and it works ... So we don't know what the problem in my setup...
If needed, here is the export. If that can help to solve the problem.
Your export settings are all correctly set up. I guess you have already tried re-exporting it and copying the files into another directory in your Unity project, right? Are the three files exported correctly? There should be the following files: filename.atlas.txt
, filename.json
and filename.png
.
If the problem persists, could you please create a zip file of your Spine project plus the exported assets and send it to contact@esotericsoftware - then we can have a look at it.
Yes we did that and the 3 files seems to work well. I Also exported another test animation from a news files and it worked well ...
Ok I send everything on the mail!
Thanks!
Mail sent! ^^
Do you find anything? :p
I'm trying different stuff here and there but nothing changes for the moment.
You were just a bit faster than me, email sent just a minute after your posting - I have tested your asset, it is actually a bug that caused the problem.
I have created the issue ticket here:
[runtimes] JSON reading - null deref bug in MeshAttachment · #1284
Haha! Thanks a lot for testing!!
Ok, so it's not my fault. That why I didn't find it haha.
Ok no problem. But then, what created the bug? And how do we get around it? Because it's blocking us a little bit in our project right now, so :p
Thanks again for your test and quick reaction!
Youre welcome!
I was further investigating - it looks as if the json export has gone wrong (since the Spine project looks ok in the Spine Editor to me):
The Hairs_Patch
entry contains no "uvs", "triangles" or "vertices":
"Hairs_Front": {
"Hairs_Front": {
"name": "CH_Mario/Cap_Front",
"type": "mesh",
"uvs": [ 0.12523, 0.82105, 0.124, 0.49907, 0.12278, 0.1788, 0.99363, 0.17705, 0.99611, 0.50597, 0.99853, 0.8263 ],
"triangles": [ 0, 4, 5, 1, 3, 4, 0, 1, 4, 1, 2, 3 ],
"vertices": [ 2, 38, -8.47, 2.82, 0.99047, 37, -8.47, 26.85, 0.00953, 1, 38, 0.54, 3.01, 1, 1, 38, 9.51, 3.2, 1, 1, 37, 9.56, -7.88, 1, 1, 37, 0.35, -7.98, 1, 2, 38, -8.07, -32.11, 0.00561, 37, -8.62, -8.08, 0.99439 ],
"hull": 6,
"edges": [ 4, 6, 0, 10, 6, 8, 8, 10, 0, 2, 2, 4 ],
"width": 40,
"height": 28
}
},
"Hairs_Patch": {
"Hairs_Patch": {
"name": "CH_Mario/Cap_Patch",
"type": "linkedmesh",
"color": "ffffff00",
"skin": "CH_Player_01",
"parent": "Hairs_Patch",
"width": 24,
"height": 30
}
},
One quick workaround could be to test if instead of exporting it as json to export it as binary. Don't forget to set the extension to .skel.bytes
so that unity can read it. This is the quickest workaround that comes to my mind until we have fixed the problem. Please let me know if this works for you!
Thanks, I'll check with my dev if that could work and come back to you!
Thanks! In the meantime, we are working on the general solution.
It's incorrect in the editor. This should not be possible:
Image removed due to the lack of support for HTTPS. | Show Anyway
A linked mesh's parent mesh should always be a source mesh, never a linked mesh. FogRyu, any idea how you could have done this? No actions we take (such as duplicate attachment/placeholder/slot/bone/skin/etc) result in this problem. Did you import JSON that you generated yourself by any chance?
In 3.7.92, Spine will automatically fix up this problem when a project is loaded. You'll see an error like this: Image removed due to the lack of support for HTTPS. | Show Anyway
I'll email you a fixed version of your project so you don't have to wait for 3.7.92.
Thank you for the file and the answer!
Wow, good question.
Haha, and I managed to do something impossible... The problem is that I did it by getting confused between the skins I think.
Hmmm, if I try to remember correctly, I have:
- Started from the Json attach to this message (made with Photoshop).
- I added the "Cap_Patch" afterwise because I realized that it was missing.
- After a while and a lot of setting on other stuff, I wanted to make a skin that didn't have a cap, but hairs. So I duplicated the parts of the cap because I wanted the hair to use about the same movements and mesh modifications.
- And I think that at the beginning my base "skin" (the parent) was the "CH_Mario" and I probably duplicated the cap directly from the skin "CH_FoG" instead of the one of "CH_Mario"?
Some kind of Mi'kmaq like that.
I hope that help. Sorry it's confused.
Oh, I'm getting the same problem!
I was just doing tests to recreate it. It seems if I duplicate a skin that has some new meshes and some linked meshes, the duplicate creates linked meshes that refer to other linked meshes. If I duplicate the original skin, everything is fine
I'm having trouble with it because I have no way to track them in the editor apart from manually checking each and every mesh
Weirder thing even, is I have some of these skins with double linked meshes that seem to work in Unity, while others make it crash
So if I upgrade to 3.7.92 it automatically fixes them or I just get a warning? Any ETA on that?
Thank you sharing the repro steps with us! I have informed Nate.
Question: with that next patch, will I be able to duplicate skins that include linked mesh correctly or it is a fix that removes them when they happen?
The fix will disallow parenting one linked mesh to another linked mesh. See this issue: JSON reading - null deref bug in MeshAttachment · #1284
That said, you could resolve this in the runtime by applying this patch: Alternative implemention of fix for #1284, no scratch buffer required.@962c1ec It ensures the order in which linked meshes are resolved is correct and doesn't lead to a crash. Totally unsupported going forward though, as the editor will no longer allow you to link linked meshes to each other.
Interesting, thanks!
So I guess in the future duplicating a skin that include linked meshes, will create meshes that link back to the original one. I'll check back into that issue on github