EEmi
- 20 sept. 2024
- Inscrit 24 août 2023
- Modifié
@Emi Unfortunately I have to state that re-using an AnimationReferenceAsset for a different
SkeletonDataAsset
(SkeletonData
actually) is not generally supported, although it will work under certain constraints.When playing an animation via a different
SkeletonDataAsset
'sAnimationReferenceAsset
, it's doing nothing more than applying theSpine.Animation
of oneSkeletonData
to a differentSkeletonData
's skeleton. So it's applyingSkeletonA.AnimationWalkA
toSkeletonB
, which might have no animations at all.As
Spine.Animation
s are applying Timelines to aSkeleton
, which are mostly modifying bones, slots, etc at certain indices, this will go well as long as both Skeletons have the exact same setup (name and order) of bones, slots, etc. Unfortunately Animations that useDeformTimelines
(deform keys, also called free-form deformation) will not apply the deformation animation to a different skeleton, because they don't use indices alone but also a direct object reference to a SkeletonData'sVertexAttachment
. ThisVertexAttachment
object reference does not match the different Skeleton'sVertexAttachment
, and thus the deformation animation will be skipped, ignoring a part of your animation.Also, it's just working due to the current way animation timelines are implemented, so it works by chance. More things might fail in future verisons of Spine like 4.2 or later versions, should the implementation change.
So in short, it is not recommended to apply animations to a
Skeleton
from a differentSkeletonDataAsset
. Sorry to say that!Likely the best reliable solution would be to automate your workflow via scripting and copy the animations over at the Spine project level, and make sure they are exported correctly for each skeleton project. If the number of animations is a problem on the Unity side, you might want to automate your Unity project setup as well using editor scripting, e.g. automatically creating and assigning each
AnimationReferenceAsset
at each imported skeleton according to a template. This way you could save manual repetitive work and still ensure everything is playing back as it should.