maco1

i have spine skeleton that that multiple slots with multiple attachments, attachments themselves don't have keyframes in animations, but slots do, so there is no problem changing attachments during runtime except one animation. i have this animation where pet is playing with ball, there are several ball sprites as attachments inside a ball slot, when i try to activate any of them by setattachment from unity, it looks like animation overwrites data and attachment doesnt get activated, only workaround i found out was to manually activate attachment during playing animation, but i dont think its a right solution,
did anyone have a problem like this one?
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
maco1
  • Mesajlar: 9

Harald

I'm not sure I understand your question correctly. If your animation has a key that sets an attachment at a slot, then when playing the animation, this attachment will be set at the slot when playback passes the key's timepoint. If you want to override anything that your animation keys, you can perform your own changes after the animation has been applied by using the SkeletonAnimation update callbacks as described here:
spine-unity Runtime Documentation: Life cycle
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4449

maco1

https://drive.google.com/file/d/1S8HJOoAKxddKR1RvpJsBhcHon5Kg7fSF/view?usp=share_link
i hope this video shows it more clearly, i first set ball, then play animation and the ball becomes active only if i set it again, while already playing animation (not before it)

the animation itself doesnt have a key that sets attachment to a slot, i'd like to set it at runtime but it gets overwritten i think
maco1
  • Mesajlar: 9

Harald

Thanks for the clarification. Which version of the Spine Editor are you using? Could you please export the problematic skeleton as a .json file and share it with us?
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4449

maco1

im using spine 4.1.14, i think idle animation overwrites the attachment?
so what i want to achieve is that, when playing rolling on floor animation, i want to activate desired ball (only while playing animation). i will send you file in a DM, or can i send file to you through an email?
maco1
  • Mesajlar: 9

Harald

You can send us the files to contact@esotericsoftware.com, briefly mentioning this forum thread so that we know the context. Alternatively you can attach the file to a forum posting, if you can share it publicly.
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4449

maco1

thanks! i have sent the file
maco1
  • Mesajlar: 9

Harald

Thanks for sending the assets! These don't look obviously wrong, could you please also send us the spine project files (the .spine file and the images directory) that was used to export these assets?

---

Thanks for sending the Spine project files.

The problem you are facing is most likely due to using the SkeletonMecanim component with the component property Mecanim Translator - Auto Reset enabled:
When set to true, the skeleton state is mixed out to setup pose when an animation finishes, according to the animation's keyed items. This may be especially important when an animation has changed attachment visibility state: when mixed out, attachment visibility will change back to setup pose state, otherwise current attachment state is held until another animation has a key set at the respective attachment timeline.
So the problem is likely having Auto Reset enabled combined with your Idle animation (which precedes the Playing on floor animation) having the ball slot keyed, thus being mixed out to setup pose (where nothing is attached at the ball slot).

In general we recommend using the SkeletonAnimation component over SkeletonMecanim, which comes with some drawbacks and limitations. If you still would like to continue using SkeletonMecanim, we would highly recommend reading the SkeletonMecanim documentation section carefully, as it also lists additional requirements regarding your animations:
spine-unity Runtime Documentation: SkeletonMecanim Component

Since you seem to be using the Spine Trial version:
Please note that the animator can use his/her license to create animations for you or your company, but you or your company must have their own license in order to integrate any of the official Spine Runtimes into their products. You are welcome though to use the Spine Runtimes for evaluation purposes.
This is also listed as the first line on the spine-unity documentation page here:
spine-unity Runtime Documentation: spine unity Runtime Documentation
If you have any further questions, please do not hesitate to ask!
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4449

maco1

i'll look into that.
Thanks!

---

I have managed to solve the issue, for anyone who has same issue this might help :d.
i added a keyframe of a ball slot on idle animation, with opacity of zero. on playing animation i just set opacity to 1 and one attachment is actived
maco1
  • Mesajlar: 9

Harald

Glad to hear you've figured it out, thanks for letting us know. Your solution is also a viable alternative to the solution proposed in my posting above.

Just as a side note: setting the alpha value of a slot to 0 will still render the geometry of an attachment (setting the vertex color's alpha value to 0 accordingly), while disabling an attachment removes the geometry from the skeleton mesh and does not render it at all.
Kullanıcı avatarı
Harald

Harri
  • Mesajlar: 4449


Dön Unity