I have 2 spine avatars: Nora & Zelly
Nora is setup as the based avatar with different animations
Zelly is setup as the skin avatar with different skins that will be added to based avatar.
Currently I have the unity runtime working:
SkeletonAnimation will automatically update the materials in LateUpdate() based on skins.
var spineBase = baseObj.GetComponent<SkeletonAnimation>();
var spineChange = switchObj.GetComponent<SkeletonAnimation>();
Spine.Skin skinDefault = spineBase.Skeleton.Data.FindSkin("all"); //Nora
Spine.Skin skinWing = spineChange.Skeleton.Data.FindSkin("wing"); //zelly
Spine.Skin skinMix = new Spine.Skin("Mix");
skinMix.CopySkin(skinDefault);
skinMix.AddSkin(skinWing);
spineBase.skeleton.SetSkin(skinMix);
spineBase.skeleton.UpdateCache();
spineBase.skeleton.SetSlotsToSetupPose();
However, it doesn't work in web runtime:
It seems like the spine runtime is not mapping the texture correctly
const newSkin = new Skin('custom-skin');
const baseSkin = basePlayer.skeleton!.data.findSkin('all');
if (baseSkin) {
newSkin.copySkin(baseSkin);
}
const wing = skinPlayer.skeleton!.data.findSkin('wing');
if (wing) {
newSkin.addSkin(wing);
}
basePlayer.skeleton!.setSkin(newSkin);
basePlayer.skeleton!.updateCache();
basePlayer.skeleton!.setSlotsToSetupPose();
basePlayer.skeleton!.setToSetupPose();
basePlayer.skeleton!.updateWorldTransform();
Thanks