spine timeScale=0 , Keep setting the animation , StackOverflow
@a674878955 Unfortunately we could not reproduce this issue. Which exact version of the spine-unity runtime are you using (name of the unitypackage, also listed in Assets/Spine/version.txt
or in the Package Manager window)?
If you are using the latest 4.2 spine-unity runtime package, could you please send us a minimal Unity reproduction project which still shows this issue? You can send it as a zip file to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context.
Spinebot I know the cause of the problem, but I think there should be an option to limit the maximum number of mixed animations, sometimes I just need to set animations when timescale=0
Harald I have sent it to you. The subject of the email is spine StackOverflow
a674878955 I have confirmed that I can open the Unity project attached to the email you sent us. I'm not sure if it's because I didn't open it with exactly the same version of Unity, but I didn't get any errors when I opened the "SpineTest" scene in it. (I opened your project with Unity 2022.3.29f1.) Could you provide the steps to see the error with the project?
Misaki
I don't know why you didn't repeat that success, but I'll tell you more about how it happened
First, the animation End event is not executed when the condition is met
Then, when animation is set, the current track is assigned to the mixingFrom of the new track
SetAnimation=>SetCurrent=>current.mixingFrom = from
Finally, enable breakpoint debugging, where you can see unlimited mixingFrom
Harald
I'm not sure why you didn't repeat the problem, maybe your unity automatically handled the stackflow problem, maybe you didn't wait long enough, I explain how the problem happened
Misaki
So setting mixingFrom to null will solve this problem
//internal mixingFrom => public mixingFrom
skeleton.AnimationState.GetCurrent(0).mixingFrom = null;//or ClearTrack()
skeleton.AnimationState.SetAnimation(0, "a1", false);
a674878955 Thank you for the additional information! We have tested again and have confirmed that we can reproduce the issue at higher FPS. We are currently investigating the cause and will let you know as soon as we find out.
@a674878955 The spine-csharp runtime has been updated (in this commit) to automatically cover this situation and no longer produce a stack overflow.
A new spine-unity 4.2 package is available for download here as usual:
https://esotericsoftware.com/spine-unity-download
Regardless, you should in general not repeatedly call AnimationState.SetAnimation
every frame. We've added a documentation section here (the "Important Note" subsection):
https://esotericsoftware.com/spine-unity-main-components#Setting-Animations
@a674878955 Glad it helped. The commit will be ported to all runtimes, so TypeScript will be covered as well. You can watch this issue ticket which lists porting progress of the different runtimes:
EsotericSoftware/spine-runtimes2705
@a674878955 And a few minutes later, the commit has already been ported to TypeScript (in this commit).
Yup! Available in all ts runtimes in 4.2.68!
Harald
That's great. You guys have a great working pattern