i'm using construct 3
is it possible to retrieve all skins and loop through it just with index? is it possible to get the skin name through this way?
is this also possible with animations?
i'm using construct 3
is it possible to retrieve all skins and loop through it just with index? is it possible to get the skin name through this way?
is this also possible with animations?
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.
does anyone happen to know how i can access skeletondata in construct 3? i've looked through the available properties for a spine object but i can't seem to find or figure it out
I'm not familiar with the Construct runtime. I believe Scirra implemented it, possibly using our runtimes. They may have implemented a wrapper that hides our APIs, in which case their wrapper would need to expose the SkeletonData or skins. Possibly you could parse the skeleton JSON to get the data.