在这种情况下,您可以修改 SkeletonJons.cs 和 SkeletonBinary.cs,以便它们采用您要加载的动画名称列表。 然后,您可以在 SkeletonJson.cs 中按名称忽略这些动画:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-csharp/src/SkeletonJson.cs#L366
对于 SkeletonBinary,它更复杂,因为您仍然需要解析完整的二进制流,即使您忽略动画。 在这种情况下,您可以对“ skeletonData.animations ”进行后处理并删除您不想要的动画。
如果您想稍后加载特定动画,则适用类似的原则。 加载骨架,丢弃不需要的动画,或者从新加载的 SkeletonData 构建一个新的 Skeleton,或者从 SkeletonData 中选择我们的动画并将其添加到现有的 Skeleton。
In that case, you can modify SkeletonJons.cs and SkeletonBinary.cs such that they take a list of animation names you want to load. You can then ignore those animations by name here in SkeletonJson.cs:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-csharp/src/SkeletonJson.cs#L366
For SkeletonBinary it is more complex, as you still have to parse the full binary stream, even if you ignore animations. In that case, you could post-process skeletonData.animations
and remove animations you don't want.
If you want to load a specific animation later on, a similar principle applies. Load the skeleton, discard animations you don't want and either construct a new Skeleton from the newly loaded SkeletonData, or pick the animation our of the SkeletonData and add it to an existing Skeleton.