I know that there's been few threads about customization lately but I'm facing a problem.

I've been working with a fairly complex character rig for a long time and today I must implement runtime equipment customization. The thing is my rig doesn't have any skin or placeholders yet.
-> The whole skeleton is animated with meshes inside their slots.

I've been playing around with the mix and match script but I can't get to change my equip and have it correctly positioned (the sprite is weirdly rotated) and is moving without meshes modification :sweat:

If I understand correctly, the only way to use Unity Sprite as new meshes copy requires Placeholders, am I correct so far ? :tmi:
In that case, what would be the best way to "upgrade" my Spine project with placeholders without recreating all the meshes and all their animations... :bang:

(Isn't this a question for Shiu ? :angel: )

Thanks :)
Mensajes: 112


Change the tree filter to attachments by clicking the attachment button:

Select your attachments, New -> Skin Placeholder to move all the attachments a under a skin placeholder. If this is grayed out, create a skin first.
Avatar de Usuario

Mensajes: 7293


Thanks Nate, it seems to work pretty well (even if I had to rearrange a little bit).
But even with a skin correctly set in my spine project I can't get to change attachment properly in runtime :/

In this example I want to change the dwarf beard from a unity sprite (picked up in a list), all the beards are just variations of color, made from the exact same sprite that the one used in the skin (same size, rotation etc)

Here is my test code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Spine;
using Spine.Unity;
using Spine.Unity.Modules.AttachmentTools;

public class SkinManager : MonoBehaviour

public Sprite[] beardSpriteList;
[SpineSlot] public string beardSlot;
public Skin newSkin;
public Skeleton skeleton;

// Use this for initialization
void Start()
beardSpriteList = Resources.LoadAll<Sprite>("Skins/Beards");
var skeletonAnimation = GetComponentInChildren<SkeletonAnimation>();
skeleton = skeletonAnimation.Skeleton;

// All attachment changes will be applied to the skin. We use a clone so other instances will not be affected.
newSkin = skeleton.UnshareSkin(true, false, skeletonAnimation.AnimationState);


// Update is called once per frame
void Update()


public IEnumerator TestChange()
yield return new WaitForSeconds(1);
RegionAttachment newBeard = beardSpriteList[1].ToRegionAttachmentPMAClone(Shader.Find("Spine/Skeleton"));

int beardSlotIndex = skeleton.FindSlotIndex(beardSlot);
var tete = skeleton.GetAttachment(beardSlotIndex,"tete"); // tête is head in french ^^
var newTete = tete.GetClone(true);
newTete = beardSpriteList[1].ToRegionAttachmentPMAClone(Shader.Find("Spine/Skeleton"));
string newBeardName = beardSpriteList[1].name;
Debug.Log("equiping :" + newBeardName);
newSkin.AddAttachment(beardSlotIndex, newBeardName, newTete);

skeleton.SetAttachment(beardSlot, newBeardName);
The beard actually changes, but seems to be weirdly rotated :/
What am I doing wrong ?
Mensajes: 112

Volver a Editor