• Runtimes
  • [UNITY] Crossfading and Animation actual frame

Related Discussions
...

Hi there,

first of all thanks you and congratulation for the spine project!

But i'll need a little help to keep the nice work.

I'm having a really hard time using the runtimes documentation. Basically I have to to some cross fading (like from walk animation to run animation, so the transition won't be so hard) and also I have to know the percentage or actual frame of an animation ingame (exporting the animation as json) for some special sounds at some specific animations

I'm not so good at programming so if anyone could help it would be really nice.

Thanks and best regards!

As for sound synchronization you should use Events.

To crossfade simply set the AnimationName or use SetAnimation. The cross fade will happen based on the Mix values set in the Skeleton Data Asset.

See the various Spineboy example scripts.

8 days later

Ok, I'll try it, but where exactly is this asset?

And how can I get a Debug.log("CurrentFrame or Percentage of the animation") ?

Thank you for the help

Where stuff is:

Image removed due to the lack of support for HTTPS. | Show Anyway

for some special sounds at some specific animations

It really sounds like you should be using Events.

https://github.com/EsotericSoftware/spine-runtimes
http://esotericsoftware.com/files/runti ... itypackage
This unity package contains a bunch of examples (and the spine runtimes - import carefully) including a new Basic Platformer example that has audio queues for footsteps based on Spine Events.

If you really really want the time specifically,

skeletonAnimation.state.GetCurrent(0).Time

This will give you the current time of the animation playing in Track 0 if there is one playing.

Frame will always be Time / 30 as Spine operates at 30fps in the editor.