Unity Ver.: 2018.3.1f1
Spine Package Ver.: 3.6 2019-05-13

Hi, i've been trying to achieve skin system, that allows user to pick skin elements at will.
User can separately buy parts of skinSets, such as body and attachments.
Each Skin containing Body Sprites, and Attachment Sprites, is exported to its own Texture.

Every Texture Contains a full skin:
  • Essential Body Parts ( such as: Torso, Head, Limbs )
  • Optional Attachments ( mustache, beard, glasses, backpack etc.)

Attachments has drawOrder that looks like this ( first element is at the background):
  • Backpack
  • Body ( It's not an Attachment but it interfere other attachments drawOrder)
  • Eyes
  • Hair
  • Beard
  • Mustache
  • Glasses

When User picks skin elements that comes from same Texture ( Material ) it somehow Changes drawOrder of other elements. Eg: having every element from different skinSets works fine, but when user tries to change any elements to match skin, the issue occurs.

Attachments are being replaced in code with
Spine.Skeleton.SetAttachment(string slotName, string attachmentName)
ScreenShot below shows custom skin, built with parts that all comes from different material. ( Notice the eye-patch from PirateSkin)


No Barrel, Visible Eye-Patch

After Attaching Barrel( comes from PirateSkin Texture), the eye-patch changes its drawOrder


Barrel Attached, Eye-Patch under the skin

Now SpineAnimation has duplicate Material ( Pirate Skin ), i understand it is because each subMesh needs its own material in right order.
But i feel its somehow connected to my issue.

I have no clue how can i bypass this problem, and achieve normal draw order for every case of chosen elements.

Another Question, is there a method to export every attachment to its own texture, without breaking already working stuff? Having it separated might be a workaround, but im not sure of this solution.
Thanks in advance for any help that comes.
У вас нет необходимых прав для просмотра вложений в этом сообщении.
  • Сообщения: 1


Did you just call SetAttachment() without SetSlotsToSetupPose() or Update()?
Then you are missing calls like the following, as shown in the Mix and Match example scenes:
skeleton.SetSlotsToSetupPose(); // Use the pose from setup pose.
skeletonAnimation.Update(0); // Use the pose in the currently active animation.
Аватара пользователя

  • Сообщения: 1824

Вернуться в Unity