This code used to pick a frame of my jump animation based on my Y velocity. Now it just loops the animation extremely fast. This change occurred when I updated the json file in my Unity project. Both the editor and the Spine-Unity runtime are up to date.
(Note: I should also mention that when this bug popped up, it came along with all of my other (more normally implemented) animations being sped up by about 250%. I was able to fix those simply by dividing all of my TimeScale changes by a fixed amount.)
if (skeletonAnimation.state.GetCurrent(0).Animation != jumplaunchAnimation)
{
stateData.SetMix(skeletonAnimation.state.GetCurrent(0).Animation, jumplaunchAnimation, 0); //adjusts mix speed
skeletonAnimation.state.SetAnimation(0, jumplaunchAnimation, true); //start animation
}
var trackEntry = skeletonAnimation.state.GetCurrent(0);
float atThisFrame = 30; //because 30 frames in the launch animation
trackEntry.TimeScale = 0.2f; //stop animation //this value used to be zero to just stop the animation while I pick frames, but that caused some issues. It's now at 0.2 in order to slow it down to near-stopping.
atThisFrame = atThisFrame * (myRigidbody2D.velocity.y / (jumpForce - 6)); //get frame we want
if (myRigidbody2D.velocity.y > 34)
{
atThisFrame = 1;
}
trackEntry.TrackTime = (30 - atThisFrame) / 30; //set animation to our desired frame