In case you don't already know: there is no need to duplicate the assets if you only want to replace materials. There are several ways how to replace them, listed on the spine-unity documentation pages here:
spine-unity Runtime Documentation: SkeletonRendererCustomMaterials
spine-unity Runtime Documentation: Changing Materials Per Instance
atleyAtOkPlay escreveu
So what I'm wondering is, what is different about the second set of Animation Reference Assets if the json is the same?
In general, if you are using the exact same animations, there is no need for a second set of AnimationReferenceAssets
, you can re-use the first set. While there is a SkeletonDataAsset
reference property, there is no problem when applying the animationReferenceAsset.Animation
to your other skeleton which is based on the compatible "duplicate" SkeletonDataAsset. The AnimationReferenceAsset
just queries an Animation object from the SkeletonDataAsset
's loaded SkeletonData. This Animation will be enqueued and applied as any Animation, applying all contained Timelines to the Skeleton, modifying bone rotations, attachment visibility, and so on.
If you still want to use two sets of AnimationReferenceAssets
, there is no problem with that. It should lead to no issues when a common json file is used behind the SkeletonDataAsset
.
atleyAtOkPlay escreveu
With the character variation, why will any animation play from the first set of Animation Reference Assets, so long as it's only the first animation? In essence, why can't it transition?
Are you sure that you haven't assigned a completely different incompatible AnimationReferenceAsset
of a third skeleton? There should be no problems with your general approach. Apart from that, please check your gameplay logic for any hidden errors and whether it really starts the second animation which is never played (e.g. by adding debug log statements).
atleyAtOkPlay escreveu I understand that the process I am attempting is an optimization time-wise on my end, and not how spine was necessarily intended to work.
Please also consider the other approaches mentioned above, as I assume that these might save you even more setup time overhead. Especially the SkeletonRendererCustomMaterials
component might be useful.
I am mostly curious to understand the nuances of the relationship between the Skeleton Data Asset, the json, the atlas, and the Animation Reference Assets. Looking forward to your comments and suggestions!
If you want to know more about the relationships, please have a look at the documentation pages here:
API Reference
While the class diagram can seem overwhelming at first, in combination with the documentation text of each section you should be able to get a good understanding of how things are linked. In addition to that, looking at the code also helps a lot. The code for AnimationReferenceAsset
is very short for example:
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-unity/Assets/Spine/Runtime/spine-unity/Asset%20Types/AnimationReferenceAsset.cs#L36