Hello everyone.
I'm really sorry to bother, but after two days reading every forum post and doc out there, I can't figure out how to make a mix and match system.
[SpineSlot] public string headSlotName; // "face" in unity editor
[SpineAttachment] public string chosenHeadName; // "images/face_04" in unity editor
public void SetSkeletonSkin(){
var skeleton = skeletonAnimation.Skeleton;
var skeletonData = skeleton.Data;
var characterSkin = skeleton.Data.FindSkin("character02");
var mixAndMatchSkin = characterSkin.GetClone();
int headSlotIndex = skeleton.FindSlotIndex(headSlotName);
var headAttachement = mixAndMatchSkin.GetAttachment(headSlotIndex, "face");
mixAndMatchSkin.SetAttachment(headSlotIndex, headSlotName, headAttachement);
skeleton.SetSkin(mixAndMatchSkin);
skeleton.SetSlotsToSetupPose();
}
My goal is to create a new skin, and change only parts of it on runtime.
The "SetSkin" function is working (my skeleton changes skin), but the SetAttachment is not, I can't change only one part of my skin.
I tried every combinations I could and followed examples on the website,but cannot figure it out :/
I'm using the spine-unity-3.8-2019-12-23.unitypackage
If anybody can help 🙂
Thanks!
Just a precision : My skeleton use multiple materials