Matthias_dp

Hi,
I wanted to try out the Spine Runtime for Unity to reduce the size of my project. I ran into three exceptions, all concerning TK2D. I found some posts in the forum with the same/similar problem. Therefor I tried to comment the lines out that caused the exception and then wanted to disable TK2D in the preferences just as it was explained in the forum thread that I found. I found the Spine tab in the preferences but no option to disable TK2D.
With no more exceptions (because I commented the lines causing it out) I tried to import a project following your tutorial, but I got even more and different errors and the Data was always "corrupted" no matter which project I tried to export.

Here are the exceptions concerning TK2D:

Assets\Spine\Runtime\spine-unity\Asset Types\SkeletonDataAsset.cs(45,10): error CS0246: The type or namespace name 'tk2dSpriteCollectionData' could not be found (are you missing a using directive or an assembly reference?)

Assets\Spine\Runtime\spine-unity\Modules\TK2D\SpriteCollectionAttachmentLoader.cs(46,44): error CS0246: The type or namespace name 'tk2dSpriteCollectionData' could not be found (are you missing a using directive or an assembly reference?)

Assets\Spine\Runtime\spine-unity\Modules\TK2D\SpriteCollectionAttachmentLoader.cs(38,11): error CS0246: The type or namespace name 'tk2dSpriteCollectionData' could not be found (are you missing a using directive or an assembly reference?)

I also tried to download the runtime from different sources (the package from your website and the zip from your github) but there was no difference.

Thank you for your help! :)
Matthias_dp
  • Mensajes: 5

Harald

We are very sorry for the trouble!
I found the Spine tab in the preferences but no option to disable TK2D.
The option to enable TK2D support is now only displayed when the TK2D package is part of your project. This logic was added to prevent accidental clicks that led to the said error messages.

It is very strange that the code compiles with the SPINE_TK2D define active in your case.
Which Unity version are you using?
I assume you have used the latest versions of the spine-unity runtime from the download page, right?

Could you perhaps describe what you did befor the TK2D compile error messages showed up?
Did you perhaps upgrade from an older verion of the spine-unity runtime?
I assume you never installed TK2D and also never clicked the Enable TK2D Support button in the Spine Preferences.
I tried to import a project following your tutorial, but I got even more and different errors and the Data was always "corrupted" no matter which project I tried to export.
This is indeed very strange. What kind of errors did you receive?
When major and minor versions of Spine and spine-unity match (both 3.8 ), there should never be any corrupt data.
Avatar de Usuario
Harald

Harri
  • Mensajes: 1728

Matthias_dp

Hi,
I'm sorry I couldn't answer earlier.
My unity version is 2019.2.0f1 and yes, I used the latest spine runtime.

I did not upgrade from another spine runtime and the TK2D error messages showed up, directly after I imported the runtime.

And yes, I never used TK2D and never had the option to click the button in the preferences.

So the first exception that I received when I imported a spine project, following your tutorial (after commenting out the lines about TK2D) is:

NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.SkeletonDataAssetInspector.PopulateWarnings () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:606)
Spine.Unity.Editor.SkeletonDataAssetInspector.InitializeEditor () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:138)
Spine.Unity.Editor.SkeletonDataAssetInspector.OnEnable () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:83)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

When I try to put the Skeleton Data into a scene I receive this:

NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.SkeletonDataAssetInspector.DrawAtlasAssetsFields () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:340)
Spine.Unity.Editor.SkeletonDataAssetInspector.OnInspectorGUI () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:188)
UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:496)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

If I create a new Skeleton Animation in a scene and pull my skeleton data to the skeleton animation script it shows the error message that I screenshoted below.

If I restart unity after a new import I receive a slightly different exception:

NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.SkeletonDataAssetInspector.PopulateWarnings () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:606)
Spine.Unity.Editor.SkeletonDataAssetInspector.InitializeEditor () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:138)
Spine.Unity.Editor.SkeletonDataAssetInspector.OnEnable () (at Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs:83)
UnityEditor.AssetDatabase:CreateAsset(Object, String)
Spine.Unity.Editor.AssetUtility:IngestSpineProject(TextAsset, AtlasAssetBase[]) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:697)
Spine.Unity.Editor.AssetUtility:ImportSpineContent(String[], List`1, Boolean) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:321)
Spine.Unity.Editor.AssetUtility:HandleOnPostprocessAllAssets(String[], List`1) (at Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs:94)
Spine.Unity.Editor.SpineEditorUtilities:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs:90)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])


I'm sure that this exceptions could all be because of mistakes that I made, but I think that I followed your tutorial.

I hope I gave all relevant information.
No tienes los permisos requeridos para ver los archivos adjuntos a este mensaje.
Matthias_dp
  • Mensajes: 5

Harald

Line SkeletonDataAssetInspector.cs:606 that you posted is inside a code branch for TK2D only, so it makes sense that this is causing troubles. And it means that the SPINE_TK2D define is still set, and thus causing wrong codepaths to be executed.

The easiest solution should be to manually remove the definition from your project settings, as described in this posting. Posting again for easier reading:

A solution is to manually remove the SPINE_TK2D defines from the ProjectSettings file:
ProjectSettings/ProjectSettings.asset
and perhaps also from
Library/ProjectSettings.asset
Just open it with a text editor and edit it accordingly.

The relevant section looks like this:
scriptingDefineSymbols:
1: SPINE_TK2D
Do you have this definition listed in your settings files?

---

I have just added additional measures to prevent this define from being activated. I guess this happened due to a Unity inspector UI bug, since the TK2D Support Enable button press it the only case where this definition is set for the project.

The latest package now also displays the Disable button when the definition is enabled (regardless of whether TK2D is installed or not), so you should be able to disable the definition via Spine Preferences now.

New Unitypackages are available here as usual:
Spine Unity Download
Avatar de Usuario
Harald

Harri
  • Mensajes: 1728

Matthias_dp

Hey and thank you!

Deleting the lines in both project settings worked for me! What is weird though is, that I had multiple "Spine_TK2D" lines (I added a screenshot).

Although I updated the runtime, the button to disable TK2D is not getting displayed, but with the removal of the lines, it is obsolete for me.

I learned a lot of new stuff about your runtime today and I am pretty impressed how much functionality and how many possibilities you're offering to work with your runtime.

There is just something I want to add: Working with the SkeletonMecanim I ran into a bug that my animations could not be looped. In a 5 year old forum post, one advised to reimport the runtime and that fixed the issue for me. I just wanted to add that.

So again: Thank you so much, you guys are awesome!! :)
No tienes los permisos requeridos para ver los archivos adjuntos a este mensaje.
Matthias_dp
  • Mensajes: 5

Harald

Glad to hear your problem is resolved now!
Matthias_dp escribió:Although I updated the runtime, the button to disable TK2D is not getting displayed, but with the removal of the lines, it is obsolete for me.
If you manually removed the definition, then the button is not displayed - the updated runtime would just display it when the SPINE_TK2D define is set, previously it only displayed it when the TK2D assets are part of your project. So everything as expected in this regard :).
Matthias_dp escribió:There is just something I want to add: Working with the SkeletonMecanim I ran into a bug that my animations could not be looped. In a 5 year old forum post, one advised to reimport the runtime and that fixed the issue for me. I just wanted to add that.
Sorry for the trouble and thanks for reporting!
Unfortunately the forum search does not find a posting about half a year back that would contain the better workaround.
Anyway, I have created an issue ticket for this issue that lists the currenly suggested workaround until the issue is resolved:
https://github.com/EsotericSoftware/spine-runtimes/issues/1649
Problem:
When a Spine Mecanim animation clip's parameters like Loop Time are modified, the state in a Mecanim Controller is not automatically updated to reflect this change, it still has the old value stored.

Workaround until this issue is resolved:
With the Mecanim Controller active in the Animator window, select the non-updated state, change either it's Name or Tag (e.g. add a whitespace character and remove it later). This will update the state immediately and reload the clip's loop parameter.
Avatar de Usuario
Harald

Harri
  • Mensajes: 1728


Volver a Unity