EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.35k stars 2.89k forks source link

[unity] Inspecting a SkeltonAnimation component during playmode leads to spam errors, animation breaking. #1835

Closed Zurigan closed 3 years ago

Zurigan commented 3 years ago

Unity 2020.1.17, looks like the Inspector is trying to create a preview window of the first material which fails, flickers the preview window on and off, all character animation stops working ... console spammed with this error:

NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.Editor.SkeletonAnimationInspector.TrySetAnimation (Spine.Unity.SkeletonAnimation skeletonAnimation) (at Assets/Plugins/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs:124)
Spine.Unity.Editor.SkeletonAnimationInspector.DrawInspectorGUI (System.Boolean multi) (at Assets/Plugins/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs:57)
Spine.Unity.Editor.SkeletonRendererInspector.OnInspectorGUI () (at Assets/Plugins/Spine/Editor/spine-unity/Editor/Components/SkeletonRendererInspector.cs:172)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <c84609c921cb488481d7d8a5fcdf9588>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Screenshot of the attempted material preview that flickers on and off: image

HaraldCsaszar commented 3 years ago

The material observation seems like a side effect, the main problem seems to be related to the animation state not being correctly setup.

Could you please send us a minimal Unity reproduction Project that still shows the error, as a zip package to contact@esotericsoftware.com or attach a link to this ticket? Then we can have a look at the issue.

Zurigan commented 3 years ago

Ugh, tried to make a quick repro project with just the spine character in it and ... it doesn't have the same issue. Would take too much of my time to more fully work out exactly what's going on here so, for now, going to have to ignore this one!

HaraldCsaszar commented 3 years ago

Thanks for letting us know. We will anyway add some if-conditions to hopefully prevent the problem from surfacing again. Thanks for reporting!