maasha

Hi there,

I've been searching for an answer to this but get various answers and honestly, it's a bit confusing.
I wanted to ask again here because most of the answers are quite old and Spine doesn't seem to have certain methods or maybe not all methods work the same way with others. For example, this thread has different results, but I still don't feel sure about the answers: https://github.com/pixijs/pixi-spine/issues/166

My situation is:

Let's say I have a spine asset with multiple tracks running.
All I want to do is clear all the animations currently playing/not playing on this asset--as if none of the animations have been applied. I want to keep the skin etc. Just no animations, and pose back to default.
Also, it's important there is no jump, error or weird flashes. I'm using Spine 3.8.

How can I do this?

Would this work?
AnimationState.ClearTracks();
Or would it lead the animation to be in a certain pose or...? I just want to reset everything to default.

Thanks for your help!
maasha
  • Сообщения: 22

Harald

If I understood you correctly, I think you may want to call animationState.ClearTracks() followed by skeleton.SetToSetupPose().

Please have a look at the documentation page for details on what each method will do:
AnimationState clearTracks
Skeleton setToSetupPose
See also the following methods:
Skeleton setBonesToSetupPose
Skeleton setSlotsToSetupPose
Аватара пользователя
Harald

Harri
  • Сообщения: 2778

maasha

Hey,

Thanks, but most of my animations are on the UI so skeleton.SetToSetupPose() doesn't work. SkeletonGraphic doesn't have SetToSetupPose() method?

Maybe I only need AnimationState.ClearTracks()?

Thanks for your help.
maasha
  • Сообщения: 22

Harald

maasha писал(а):Thanks, but most of my animations are on the UI so skeleton.SetToSetupPose() doesn't work. SkeletonGraphic doesn't have SetToSetupPose() method?
Every one of the three components SkeletonAnimation, SkeletonGraphic and SkeletonMecanim has it.
var skeleton = skeletonGraphic.skeleton;
Аватара пользователя
Harald

Harri
  • Сообщения: 2778

maasha

Yep, you're completely right. Thank you!
maasha
  • Сообщения: 22

Harald

You're welcome :)
Аватара пользователя
Harald

Harri
  • Сообщения: 2778


Вернуться в Unity