• Unity
  • Is this a bug with OnComplete callback?

Related Discussions
...

Example 1:

ani.loop = bLoop;
ani.AnimationName = stateType.ToString();
ani.state.Event += HandleEvent;
ani.state.Complete += HandleComplete;

When this is written, it causes premature execution of the OnComplete callBck.
For example, it would take 3 seconds to finish the play,
But in 2.5 seconds, the back drop function is executed.

Example 2:

ani.state.ClearTrack(0);
ani.state.SetAnimation(0, stateType.ToString(), bLoop);
ani.state.Event += HandleEvent;
ani.state.Complete += HandleComplete;

When this is written, if I switch from an action that has not been played to another action.
(if the model has 2 balls, the 1 is the model itself, and the other is the sphere of special effects)
On the previous action without playback, the effects will be left on the model.

Is there a good way to clean up this problem caused by switching?
Tanks!

I'm having trouble understanding the problem(s).

370688 a écrit

When this is written, it causes premature execution of the OnComplete callBck.

How long is your animation? Is it looping? Make sure you read the AnimationStateListener docs.

370688 a écrit

On the previous action without playback, the effects will be left on the model.

If you don't want that, don't use AnimationState clearTrack. You can set a new animation without clearing the track. If you want an instant transition, use a TrackEntry mixDuration of 0.

If I use the first solution,
The onComplete function occasionally triggers in advance. Why?

Please answer the questions I asked you. If your animation is 2.5 seconds long, then complete should fire at 2.5 seconds. If it loops, it should fire at every 2.5 seconds. The end event will fire when the animation is no longer played.

You are using spine-unity? Are you using the latest version in Git master? We have extensive tests for the reference runtime implementation, I'm confident it fires the complete event at the correct times. It could be you have encountered a bug in the C# port.

:x :x :x :x :x :x :x
Sorry,That's my problem.... I've already finished it