- Изменено
[Unity] Animation not working when transition is interrupted
I'm using SkeletonAnimator because it's convenient in Unity, but I found a bug when I use interruption source in Animator.
I have a transition from A to B, and one from A to C. The transition from A to C has a higher priority.
I set both two transition's interruption source to current state, which enables a transition interruption.
In Unity, the result should be like this:
When the animator is playing a transition from A to B, the transition A to C can interrupt the transition, and start a new transition from X to C.
However, the spine animation just stops playing until the transition from X to C is finished. Then it suddenly starts playing from the next frame after the transition of animation C. (It means if the transition of X to C ends at the 5th frame of C, the animation starts playing from the 6th frame of C)
When the player is playing a landing animation, I move the player, and the transition goes from landing to moving.
Then the player starts to fall, so the animator interrupt the transition and starts the transtion from X(a state between landing and moving) to falling .
However, the transition from X to falling is totally wrong. It just stops all the animations and plays nothing (just like T-pose in 3D games):
Anyone has an idea about how to deal with the problem, or it's just a bug in Spine-Unity's SkeletonAnimator?
Many thanks.
Did you check your falling state in the state machine to see if the dummy AnimationClip on it is actually set?
Pharan написалDid you check your falling state in the state machine to see if the dummy AnimationClip on it is actually set?
Yes. If I just move the player and fall, without interrupting any transition, the transition from moving to falling works perfectly.
I made a simple animator with only 3 animations with different end time to test the bug, and it also shows the same problem:
No new replies up to now...sad...
I guess maybe I should use SkeletonAnimation with self-defined state machine instead of SkeletonAnimator which is new and incomplete. It's quite a pity.
Hey, sorry you haven't gotten an answer yet! Pharan's currently away for a bit. We'll try to get you an answer to this specific issue as soon as possible!
Are you able to send us a zipped copy of this test case? I'm not able to repro it.
You can send it to unity@esotericsoftware.com
I'm very sorry that you did not receive any solution to the problem yet.
Jumping in to help on the subject, I was already able to reproduce your problem - your description was really precise an helpful, thanks for that! This really seems to be a bug - either on our side or on Unity's API returning incorrect animation clip state. Currently working on the bugfix with highest priority.
I'll keep you updated and let you know as soon as we have the bugfix ready.
Thanks for your patience.
Thanks for checking it out Harald.
[unity] Animation not working when transition is interrupted · #1208
It is a very strange case.
Just looking at how the state machine is shown too, it doesn't seem to look right.
But as mentioned in the issue, when polling the Animator for clips within that window of time when it's interrupted, Unity seems to be returning nothing. 0 clip count. 0 clips. 0 next clips. No information. Without the correct information (or any information for that matter), there's not much we can do on the SkeletonAnimator/SkeletonMecanim side.
I've tried this setup in both Unity 5.6 and Unity 2018.2. The same thing happens.
We'll see if we can make a simple repro without involving Spine and send it as a report to Unity tech.
Admittedly, I don't work with Mecanim state machines myself often and on a detailed level. Is there anything special about your transition settings that you suspect may be causing this?
Harald написалI'm very sorry that you did not receive any solution to the problem yet.
Jumping in to help on the subject, I was already able to reproduce your problem - your description was really precise an helpful, thanks for that! This really seems to be a bug - either on our side or on Unity's API returning incorrect animation clip state. Currently working on the bugfix with highest priority.
I'll keep you updated and let you know as soon as we have the bugfix ready.Thanks for your patience.
Thanks for the reply. Looking forward to the improvement, for Spine is really a good tool for 2d games.
Thanks, very glad you like Spine!
We just discovered that although clipCount and nextClipCount both return 0, the nextClips array is filled with one entry (that's all we get) - therefore we shall be able to create a bugfix soon. So if everything can be worked-around as expected, no need to wait for Unity to fix anything.
Harald написалThanks, very glad you like Spine!
We just discovered that although clipCount and nextClipCount both return 0, the nextClips array is filled with one entry (that's all we get) - therefore we shall be able to create a bugfix soon. So if everything can be worked-around as expected, no need to wait for Unity to fix anything.
That's quite a good news! :rock:
Hope everything goes well!
Harald написалThanks, very glad you like Spine!
We just discovered that although clipCount and nextClipCount both return 0, the nextClips array is filled with one entry (that's all we get) - therefore we shall be able to create a bugfix soon. So if everything can be worked-around as expected, no need to wait for Unity to fix anything.
Sorry to bother you. Is there any progress on this project?
It seems as if we are pretty close to the correct solution - now there is an incorrect frame at the end of the interruption that still needs to be resolved. This required some rather significant changes, therefore things need to be tested thoroughly thereafter. After all tests are passed we will get back to you of course.
Harald написалIt seems as if we are pretty close to the correct solution - now there is an incorrect frame at the end of the interruption that still needs to be resolved. This required some rather significant changes, therefore things need to be tested thoroughly thereafter. After all tests are passed we will get back to you of course.
Thanks for reply!
I've tried to fix the bug too, and there is also an incorrect frame at the end, which is quite embarrassing :x .
Now I have to ignore the bug temporarily and move on for other features of my game.
Hope everything goes well with you. Looking forward for feedbacks!
You're welcome. We are working on the bugfix for the end-frame as well, no worries. I'll let you know as soon as everything behaves as it should - hope there are no more hidden treasures discovered after this end-frame issue.
I have just committed the bugfix to the repository (both 3.6 and 3.7-beta branches), so the next updated package will contain the fix.
Harald написалYou're welcome. We are working on the bugfix for the end-frame as well, no worries. I'll let you know as soon as everything behaves as it should - hope there are no more hidden treasures discovered after this end-frame issue.
I have just committed the bugfix to the repository (both 3.6 and 3.7-beta branches), so the next updated package will contain the fix.
Good Job! Thanks for replying! :yes:
You can download the unitypackages containing the bugfix from here: Spine Unity Download.