atleyAtOkPlay

Hello,

Thank you for your time.

I am trying to have two characters which share the same json. The only difference is the texture that is assigned to the material of their faces. My process:

1. Create the character.
-Export json, atlas.txt and pngs from Spine
-Connect all and animate.
=> This works fine.

2. Create the character variation.
-In unity, create a new Skeleton Data Asset using the json from step 1.
-Duplicate the atlas from step 1. Swap the face material for a new face material.
-Connect all and animate.
=> The character variation play any animation fine so long as it is the first animation called. After that, the skeleton freezes.

I should add too that our system animates by finding animations using the Animation Reference Assets. If I create a new set of animation reference assets for the character variation in step 2, and use those to animate, then everything works fine.

So what I'm wondering is, what is different about the second set of Animation Reference Assets if the json is the same?

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?

Thank you again very much for your insight, I really appreciate it. 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. 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!

All the best,
Atley
atleyAtOkPlay
  • Сообщения: 3

Harald

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 писал(а):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 писал(а):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 писал(а): 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
Аватара пользователя
Harald

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


Вернуться в Unity