In our game , we create some avtar for our main character.
We implement it throughthe code below: Ps. we refer the sample "Mix and Match Equip".
Spine.Skin.SetAttachment(slotIndex, attachmentName, attachment);
Original design:
After change skin:
There are 3 materials after change the new skin , so we have to optimize that by combining all materials together.
//repacked skin
public void OptimizeSkin () {
// 1. Collect all the attachments of all active skins.
collectedSkin = collectedSkin ?? new Spine.Skin("Collected skin");
collectedSkin.Clear();
collectedSkin.AddAttachments(skeletonAnimation.Skeleton.Data.DefaultSkin);
collectedSkin.AddAttachments(equipsSkin);
// 2. Create a repacked skin.
var repackedSkin = collectedSkin.GetRepackedSkin("Repacked skin", skeletonAnimation.SkeletonDataAsset.atlasAssets[0].PrimaryMaterial, out runtimeMaterial, out runtimeAtlas);
collectedSkin.Clear();
// 3. Use the repacked skin.
skeletonAnimation.Skeleton.Skin = repackedSkin;
RefreshSkeletonAttachments();
}
After these code , the main texture have been combined as well.
but how could I combine the emission texture through the similar way ?
Thank you for your help.