• Editor
  • Skins & files with multiple skeletons (Guest star: Unity)

Hey everybody!

We are using a file with multiple skeletons (that share the same atlas).
Everything works great until we start to use skins.
When importing the exported JSONs (that have skins) to Unity, they have problems locating their assets on the atlas (editor errors, slots don't have their attachements etc.)

Do you know of a workaround? Or is this something that shouldn't be possible to begin with?

Thanks,
Michael

It should work. Might just be a settings thing, or a minor bug in exporting.

I would check the following things:

  • the logged errors: What attachment did it say it failed to find? Does it log anything at all?
  • the atlas.txt files: What are the regions named in the packed version? Are they there at all?
  • the json: What are the skin attachment paths? What are the keyed names? Do they match? Do they match the atlas region?
  • the runtime skins: What are the paths of the attachments in the skin? Does it match what the json says (if the json is correct)? Does loading even succeed?

Could you check these or can you share these files/information to check?

Sure! I'll just forward this to our Unity expert - will be back soon.

Error Log from the Skeleton Asset:

UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType)
UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options)
UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUILayoutOption[] options)
UnityEngine.GUILayout+HorizontalScope..ctor (UnityEngine.GUILayoutOption[] options)
Spine.Unity.Editor.SkeletonDataAssetInspector.DrawUnityTools ()
Spine.Unity.Editor.SkeletonDataAssetInspector.OnInspectorGUI ()
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect)
UnityEditor.DockArea:OnGUI()
Scope was not disposed! You should use the 'using' keyword or manually call Dispose.
UnityEngine.Scope:Finalize()
Internal_GetGUIDepth can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.Scope:Finalize()

Error Log from Instantiated Asset:

Retrieving array element that was out of bounds
UnityEditor.SerializedProperty:GetArrayElementAtIndex(Int32)
TMPro.EditorUtilities.TMP_MeshRendererEditor:OnInspectorGUI()
UnityEditor.DockArea:OnGUI()
´NullReferenceException: Object reference not set to an instance of an object
TMPro.EditorUtilities.TMP_MeshRendererEditor.OnInspectorGUI ()
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect)
UnityEditor.DockArea:OnGUI()

Strangely the instance error references TextMeshPro, even though the object in question is not using any TMPro asset. All Errors are endlessly stacking up.

The graphics are on the atlas.png, the imported atlas asset has them correctly referenced and visible. Names seem to match with the Skeleton.jsons in question. But I am also not sure for what to look out for exactly.

I had the idea to edit the instance in debug-inspector mode and changed the "Initial Skin" by hand in there from default to a specific skin, and everything popped into place for some of the instanced objects at least. I just realized, might this have to do something with the fact, that the "default" skin is empty though the other skins are not?

No it doesn't log them, they just won't show up on the skeleton I attached an Inspector screenshot, that made me curious Hope this helps 🙂 !

5 days later
bs_bene wrote

I had the idea to edit the instance in debug-inspector mode and changed the "Initial Skin" by hand in there from default to a specific skin, and everything popped into place for some of the instanced objects at least. I just realized, might this have to do something with the fact, that the "default" skin is empty though the other skins are not?

That's a good observation. I don't think we have a test skeleton for that, so I'll try it out on our end and see if we can reproduce the problem, hopefully find it and squash it.

The rest of the errors logged just seems like the inspectors cascading into incorrect states. Not likely the root of the problem, though it's weird how flimsy it is.


So I tried a skeleton with skins but with an empty default skin. Seems to work fine.

Pharan wrote

So I tried a skeleton with skins but with an empty default skin. Seems to work fine.

Did your test include having several skeletons with the same atlas asset and mixed skin setups on those skeletons?

Tested that too. Works fine.

Do you know under what other conditions this specifically happens? (ie, the difference between this, and other setups that work fine. I guess apart from it being a shared atlas, which doesn't seem to be the problem.)

The logged inspector errors don't seem to be informative, except to suspect TextMeshPro (which seem to have the actual, functional errors)

Contacted you via PM, could send you a zip with the animations generating these errors.

Yes, please do. You can email to unity@esotericsoftware.com. Just attach it or send a download link.


@[deleted]
I tried them on a project with just Spine-Unity.
Apart from having to choose a skin so they show up, they work fine. No errors.

I also tried deleting the Unity assets and reimported just the json, atlas and png. That worked fine too.

I guess than this might actually be an incompatibility with Textmesh Pro? Seems rather strange, because I get Edtior errors. I might ask over there, maybe their scripts are Hijacking the meshrenderer for their Purposes at Editor Time and has nothing to do with the runtime itself.

Setting the Skins does work for me as well now. Editor has gotten so slow (because of the described endless logging of said errors) that I had a problem setting those.

You do not have any issues at all neither as RawSkeleton Data nor as instantiated animation? The Inspector can also show you all attachments on the Skeleton Data?

No errors logged in the console. No slow downs.
And they seem to work fine as far as I can tell.

I discovered there's the tiny GUI update error that every now and then in the GUI's Repaint event.

Getting control 16's position in a group with only 16 controls when doing Repaint
Aborting

This happens when I switch selection between SkeletonDataAssets and the Slots foldout is expanded. I need to do a pass on all the inspectors to fix this stuff though (as harmless as they are).

But apart from that, yeah, the SkeletonDataAsset works fine. Preview works. Instantiating into a scene object works. Attachments listed in the inspector match the json.


So I fixed the GUI update error problem...

Not sure what's would go wrong with TextMeshPro, but I don't have that asset to be able to say anything definitive.