Hello. So we are trying to make a randomly generated npc system. We have different parts for each body. We based it on the "mix-and-match-pro" example project.
I figured out how to assign skins based on my code below:
[SpineSkin] public string templateSkin;
[SpineSkin] public string hair;
[SpineSkin] public string body;
[SpineSkin] public string shirt;
[SpineSkin] public string bottom;
[SpineSkin] public string eyes;
public SkeletonDataAsset skeletonDataAsset;
SkeletonData skeletonData;
SkeletonAnimation skeletonAnim;
Skeleton skeleton;
Skin newSkin;
private void Awake()
{
skeletonAnim = GetComponent<SkeletonAnimation>();
skeleton = skeletonAnim.skeleton;
skeletonData = skeletonDataAsset.GetSkeletonData(true);
newSkin = new Skin("temp skin");
}
private void Start()
{
Debug.Log(body);
newSkin.AddAttachments(skeletonData.FindSkin(body));
newSkin.AddAttachments(skeletonData.FindSkin(bottom));
newSkin.AddAttachments(skeletonData.FindSkin(shirt));
newSkin.AddAttachments(skeletonData.FindSkin(hair));
newSkin.AddAttachments(skeletonData.FindSkin(eyes));
skeletonAnim.skeleton.SetSkin(newSkin);
skeletonAnim.skeleton.SetSlotsToSetupPose();
//skeletonAnim.AnimationState.Apply(skeleton);
}
Now what I want to know is, is there a way to get a list of the skins in each category so I wouldn't have to type each one of them or assign them as a [SpineSkin] string?