Currently, there are 3 sources of timescale on an instance of SkeletonAnimation.
- skeletonAnimation.TimeScale
- skeletonAnimation.AnimationState.TimeScale
- the TrackEntry timescale.
By default, all three have a value of 1, meaning the animation just plays at 100% speed.
These are combined multiplicatively. So if you set, skeletonAnimation.TimeScale = 0.5f and skeletonAnimation.AnimationState.TimeScale = 0.5f and SetAnimation(0, animationName, loop).TimeScale = 0.5f, you will get a speed of 0.5f * 0.5f * 0.5f which results in 0.125f.
So you have to decide which timescale you want to control and control it as you want.
Note that in your first OnStateEnter example, you are setting the TimeScale on a TrackEntry. Your code is equivalent to:
var trackEntry = anim.AnimationState.SetAnimation(track, AnimationName, loop);
trackEntry.TimeScale = AnimationSpeed;
The TrackEntry only lasts until that animation playback ends. And changing its timescale does not affect the timescale of other animations.
Where you used anim.timeScale, that's SkeletonAnimation.TimeScale, which is different from the first example.
Where you used anim.state.TimeScale, that's SkeletonAnimation.AnimationState.TimeScale which is also different from the other two examples.
Again, pick one of the three TimeScale values you want to control and control it sensibly, and/or understand how they combine and manage them as you need.