Yes, it is possible to loop through all available skins and retrieve their names using an index. In the Spine API, you can access the SkeletonData
object, which contains an ExposedList<Skin>
of all skins. You can iterate through this list to access each skin and its name. Here's a code snippet demonstrating how to do this:
SkeletonData skeletonData; // Assume this is already initialized with your skeleton's data
ExposedList<Skin> skins = skeletonData.Skins;
for (int i = 0; i < skins.Count; i++) {
Skin skin = skins.Items[i];
string skinName = skin.Name;
// Now you have the skin's name and can use it as needed
}
For animations, a similar approach can be used. The SkeletonData
object also contains an ExposedList<Animation>
of all animations. You can loop through this list to access each animation and its name:
ExposedList<Animation> animations = skeletonData.Animations;
for (int i = 0; i < animations.Count; i++) {
Animation animation = animations.Items[i];
string animationName = animation.Name;
// Use the animation's name as needed
}
This approach allows you to retrieve and use the names of all skins and animations by iterating through them with an index.