I have 2 characters (a gameobject with the spine stuff). 1 with generic enemies skins, and other with bosses skins. I have a string with the name of the skin, and I want to check on which of the 2 characters that skin exists . I don’t find a method for this. I have skeletonAnimation.skeleton.Skin to get the actual skin, but not the list of all available skins.
Here are some extension methods.
public static class SpineExtensions
{
public static bool CheckIfAnimationExists(this Spine.AnimationState animationState, string animationToUse)
{
if(animationState == null)
{
return false;
}
if(animationState.Data.SkeletonData.FindAnimation(animationToUse) != null)
{
return true;
}
return false;
}
public static bool CheckIfAnimationExists(this Spine.AnimationState animationState, Spine.Animation animationToUse)
{
if(animationState == null)
{
return false;
}
if(animationState.Data.SkeletonData.FindAnimation(animationToUse.Name) != null)
{
return true;
}
return false;
}
public static bool CheckIfSkinExists(this Spine.AnimationState animationState, string skinToUse)
{
if (animationState == null)
{
return false;
}
if (animationState.Data.SkeletonData.FindSkin(skinToUse) != null)
{
return true;
}
return false;
}
public static bool CheckIfSkinExists(this Spine.AnimationState animationState, Spine.Skin skin)
{
if (animationState == null)
{
return false;
}
if (animationState.Data.SkeletonData.FindSkin(skin.Name) != null)
{
return true;
}
return false;
}
}