x_bin As recommended by Spinebot, check out the example scene Spine Examples/Other Examples/Mix and Match Equip
.
This scene demonstrates how to attach a new image to the skeleton using Sprites as the source image instead of the original image in the texture atlas, and how to pack the original image and the added image into a single texture at runtime.
When you play the scene and press the buttons for each piece of equipment, the appearance of Spineboy's corresponding attachments will change and additional materials will be added:
Pressing the Done
button will repack the textures into a single page and combine the used materials into one:
See the example script EquipButtonExample.cs
attached to each button, the EquipSystemExample.cs
attached to the GameObject Mix and Match
, and the EquipsVisualsComponentExample.cs
attached to the GameObject World Spineboy
for how this is actually done.
For more information on the Skin.GetRepackedSkin()
method, please see the documentation: spine-unity 运行时文档 #组合皮肤