I have Spine animation with dozen skins. The problem is that when I call SetAnimation, the animation glitches: it shows part of the other skins that are on the same image for a few frames + looks like current animation is blended with past. And it don't stop! The more time SetAnimation is called, more disturbing glitches are (more blending).
I did not have this problem with same animation with Unity 4.6 and version of spine-unity runtimes at the time. A month ago or so, I updated Unity, got new runtimes and animation glitch with it.
//I subscribe to an Event skeletonAnimation.state.Complete on void Start()
private void OnAnimationComplete(Spine.AnimationState state, int index, int loopCount)
{
if(ANY_BUT_IDLE == index) StartCoroutine(setToIdle());
else if(loopCount == tracker) StartCoroutine(setToSomething());
}
private IEnumerator setToIdle()
{
yield return new WaitForSeconds(0);
skeletonAnimation.skeleton.SetToSetupPose();
skeletonAnimation.state.SetAnimation(0, idleAnim, true);
}
private IEnumerator setToSomething() have same logic as IEnumerator setToIdle() except loop = false.
EDIT
I added
skeletonAnimation.state.ClearTracks();
before SetAnimation call and result is:
Unity editor No blending, significantly reduced glitch that shows other skins and it occurs on SetAnimation call and lasts few frames. This is VERY bad, but better then it was before.
On my device - SAMSUNG SM-G355HN - Android 4.4.2 this produces same glitch that is first described in this post, except no animation blending is happening, BUT when I deactivate script that is controlling animation and put just one to loop, no glitches occur nether on device nor editor.
Can anyone help me?
****ANOTHER UPDATE***
New info. I found out that on more powerful android device glitch occurs less frequently. I do not understand why this is a problem. My app works on 50-60 fps on my device while glitch is present.
22 Sep 2015, 15:09
UPDATE
On my device - When I kill all apps that work in background, glitches occur less often!
24 Sep 2015, 13:24
UPDATE
Isolating frame where glitch occurs I found out that about 90% overhead is happening at that time. I am confused with it because animations are not resource demanding...or am I mistaking? What are spec of the animation in Spine that runs well on mobile?
25 Sep 2015, 11:35
wholovesthesun? написалI have Spine animation with dozen skins. The problem is that when I call SetAnimation, the animation glitches: it shows part of the other skins that are on the same image for a few frames + looks like current animation is blended with past. And it don't stop! The more time SetAnimation is called, more disturbing glitches are (more blending).
I did not have this problem with same animation with Unity 4.6 and version of spine-unity runtimes at the time. A month ago or so, I updated Unity, got new runtimes and animation glitch with it.
//I subscribe to an Event skeletonAnimation.state.Complete on void Start()
private void OnAnimationComplete(Spine.AnimationState state, int index, int loopCount)
{
if(ANY_BUT_IDLE == index) StartCoroutine(setToIdle());
else if(loopCount == tracker) StartCoroutine(setToSomething());
}
private IEnumerator setToIdle()
{
yield return new WaitForSeconds(0);
skeletonAnimation.skeleton.SetToSetupPose();
skeletonAnimation.state.SetAnimation(0, idleAnim, true);
}
private IEnumerator setToSomething() have same logic as IEnumerator setToIdle() except loop = false.
EDIT
I added
skeletonAnimation.state.ClearTracks();
before SetAnimation call and result is:
Unity editor No blending, significantly reduced glitch that shows other skins and it occurs on SetAnimation call and lasts few frames. This is VERY bad, but better then it was before.
On my device - SAMSUNG SM-G355HN - Android 4.4.2 this produces same glitch that is first described in this post, except no animation blending is happening, BUT when I deactivate script that is controlling animation and put just one to loop, no glitches occur nether on device nor editor.
Can anyone help me?
****ANOTHER UPDATE***
New info. I found out that on more powerful android device glitch occurs less frequently. I do not understand why this is a problem. My app works on 50-60 fps on my device while glitch is present.
22 Sep 2015, 15:09
UPDATE
On my device - When I kill all apps that work in background, glitches occur less often!
24 Sep 2015, 13:24
UPDATE
Isolating frame where glitch occurs I found out that about 90% overhead is happening at that time. I am confused with it because animations are not resource demanding...or am I mistaking? What are spec of the animation in Spine that runs well on mobile?
I solved the problem with baking... Which is not much of a solution but will help this time....
After I baked the animation I found this thread Framerate editing . I think this info will be useful in the future.