Thanks for the additional information.
Bali_Jun TrackTime设置时是一个很小的负值,但错误的表现应该与此无关
Why would a negative track time not be a problem?
You should limit the TrackTime to 0 via trackTime = Mathf.Max(0f, trackTime)
then.
Have you tried limiting the trackTime like this?
TrackEntry trackEntry = kvp.Value.AnimationState.GetCurrent(0); // <-- this line has no effect
trackEntry = kvp.Value.AnimationState.SetAnimation(0, spineAnimNameDic[animData.spineNum], true);
Here the first line has no effect. I assume that your original code does more than the code shown. What else happens in the original code?
In general I see nothing obviously wrong with your code, except if you set negative track times.
This will not solve any issues of showing the setup pose for a single frame.
Bali_Jun 另外,美术各个动画的首尾帧也都K为了关键帧,我也尝试了使用 skeletonAnimation.Update
Which skeletonAnimation.Update
? There are two method, one which accepts the deltaTime
Bali_Jun 除此之外,我想询问的是:假如说我希望在11.21s这个时间点开始播放动画A,但实际上最接近的一帧为11.22s,那么此时我是否需要微调 TrackEntry.TrackTime来达到一个更准确的表现效果?
I'm not sure what you would like to achieve. Skeleton animation in general is continuous and has no clear stepped frames, it's just seconds of playback time. If you want to precisely place something on a certain frame with 60fps, just set the TrackTime
to frame / 60.0f
, or frame / 30.0f
for 30fps.
Bali_Jun 假如我使用AddAnimation 添加了四个动画到队列中,那么只有当最后一个动画播放完毕时才会调用 OnComplete回调,这似乎和我在文档上看到的不一样,请问这是正常的吗
No, OnComplete
is called every time an animation completes a loop:
http://esotericsoftware.com/spine-api-reference#AnimationStateListener-complete
In general it is never necessary to avoid setting loop
to false and add animations multiple times to emulate the same behaviour. If you need this, something is wrong with your logic code. If you can create a minimal Unity project with minimal code that still shows your issues, we can have a look at what's going wrong. You can send the Unity project as zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at it.
If you can't reproduce the issue with a minimal project, it's likely a problem with your code, then you might want to check with a debugger what values are passed to the SetAnimation method calls and what values are actually set at the TrackEntry.