The problem is due to Unity Project Settings - Editor - Enter Play Mode Settings
Enter Play Mode Options
being enabled and Reload Scene
being disabled. This will not call Awake
on ExecuteAlways
and ExecuteInEditorMode
components (which is kind of an annoying asymmetric design :rolleyes🙂, as described here. Now SkeletonAnimation.Awake()
is not called, and due to bad luck in script execution order SkeletonAnimation.Start()
is called after your script's Start()
call.
Now to fix this error, you would need to call skeletonAnimation.Initialize(false);
once in Start()
before calling _skeletonAnimation.AnimationName = _idle;
.
We will add an automatic call to Initialize(false);
to these Properties on the 3.8 and 4.0 branches, as this does not break existing behaviour (it has no effect when everything was correct beforehand, a null reference exception would occur anyway when not).
We have just committed the bugfix. New 3.8 and 4.0 unitypackages are available for download here as usual:
Spine Unity Download
Thanks for reporting!
For reference: this issue has been tracked under this issue ticket:
https://github.com/EsotericSoftware/spine-runtimes/issues/1919