Hello
I am using the latest unity runtimes + new animationstate from pharan (question in runtimes because more of a runtime design question)
there are a few wierd behaviours that I have not noticed in other runtimes, or just didn't happen and I'm not sure which.
Firstly, The complete event fires after every loop.
Also, the interrupt event fires after the complete event on a non looping animation.
The below code is a check for when an animation ends:
private void AnimationComplete(TrackEntry trackEntry)
{
if (!trackEntry.Loop)
{
m_History.Add(new EntryData(trackEntry, Time.time, Time.time - trackEntry.TrackTime));
m_MoveScrollpos = true;
}
}
private void AnimationInterupt(TrackEntry trackEntry)
{
if (!trackEntry.IsComplete || trackEntry.Loop)
{
m_History.Add(new EntryData(trackEntry, Time.time, Time.time - trackEntry.TrackTime));
m_MoveScrollpos = true;
}
}
note the convoluted checks to see if it really fired (I had to repeat this pattern a lot when I upgraded the runtimes)
So my questions really is, should the complete
event fire on every loop of an animation, should the interrupt
event fire after a complete
event? And is there a better way to get when an animation end? (not End
event, as that fires too late, iirc depending on the mix)