How do I check if a track is empty?
This is for an idle mode, i want to set track 3 to empty, if it's not empty.
If it's empty, don't do anything.
SetAnim with parameter null calls SetEmptyAnimation.
if (skeletonAnimation.state.GetCurrent(3) != null) {
Debug.Log(Time.frameCount + ": Track 3 is not null, has anim = " + skeletonAnimation.state.GetCurrent(3).Animation.Name);
SetAnim(3, null, mix: 0.2f, loop: false, allowReset: true, timeScale: 1);
}
I get:
439: Track 3 is not null, has anim = <empty>
If I use this code I get a nullref on the second check in the if statement.
if (skeletonAnimation.state.GetCurrent(3) != null || skeletonAnimation.state.GetCurrent(3).Animation.Name != "<empty>") {
Debug.Log(Time.frameCount + ": Track 3 is not null, has anim = " + skeletonAnimation.state.GetCurrent(3).Animation.Name);
SetAnim(3, null, mix: 0.2f, loop: false, allowReset: true, timeScale: 1);
}
So how do I check if an animation track is empty?
Thanks!