hello,
This happens in multiple places, and happens in multiple checks.
When I play an animation which alters the colour of a slot, and wait for it to end, it ends
too early. for example, if I was to have an animation which turned the alpha from 255 to 0, and I waited for that animation to be end, the image would still be visable when the animation "ends" ( I would expect it to be 0 )
Here I play an animation and wait for it to end. after it ends I set the game object to be inactive.
m_Animator.PlayAnim("exit",TRACK_0); //omitted some data, but this calls setanimation in spine api
yield return new Spine.Unity.WaitForSpineAnimationComplete(m_Animator.GetCurrentTrackEntry(0));
gameObject.SetActive(false);
I could kind of imagine here, that the thing would still be visible, as the complete event key is happening on the last frame (?).
However I have this code which produces the same result.
m_Animator.PlayAnim("exit",TRACK_0);
while (m_Animator.IsAnimationPlaying("m_Exit",0))//Checks if the name of the track is "exit"
yield return null;
gameObject.SetActive(false);
Here I check the name of the animation. If the animation name changes then deactivate the object.
If I enable the object later, for one frame the object will appear as it does a frame or two before the animation ends (i.e. visible, slot colour did not change all the way.
Waiting a frame stopped this. However this is not always possible. Why doesn't the animation end when.... well when it ends. Does blending cause the animation name to switch earlier but the animation to still play? .
22 Jun 2016, 15:40
So... blending does seem to be a part of the issue. atleast for checking the name of the animation, I used this (buggy atm) code to get around it
Isanimplaying(string name)
if (m_Animation.state.GetCurrent(track).Name !=name)
if (m_Animation.state.GetCurrent(track).previous == null || m_Animation.state.GetCurrent(track).previous.animation.Name != name)
{
return false;
}
if ( m_Animation.state.GetCurrent(track).previous != null && m_Animation.state.GetCurrent(track).previous.animation.Name == name && m_Animation.state.GetCurrent(track).mixTime >= m_Animation.state.GetCurrent(track).mixDuration)
{
return false;
}
else
return true;
}
return true;
}