hi
so my problem is probably simple : when i change "skins", straight to curly, I loose all the color i apply to my Attachment.
it goes back to white, here 's my code, what did i do wrong ? or is it normal ?
Loading Image
public void changeHair(int numbers)
{
if (numbers == 0)
{
skeletonAnimation.Skeleton.SetSkin("curly");
}
if (numbers == 1)
{
skeletonAnimation.Skeleton.SetSkin("straight");
}
}
void Start()
{
skeletonAnimation = this.GetComponent<SkeletonAnimation>();
Skin1 = skeletonAnimation.Skeleton.FindSlotIndex("face");
attachmSkin1 = skeletonAnimation.Skeleton.GetAttachment(Skin1, "Skin");
//etc...
}
private void ColorChangeSkin(Color newColor)
{
ChangeAttachmentColor(attachmSkin1, newColor);
ChangeAttachmentColor(attachmSkin2, newColor);
//etc...
}
void ChangeAttachmentColor(Attachment attachment, Color color)
{
RegionAttachment regionAttachment = attachment as RegionAttachment;
if (regionAttachment != null)
{
regionAttachment.SetColor(color);
}
MeshAttachment meshAttachment = attachment as MeshAttachment;
if (meshAttachment != null)
{
meshAttachment.SetColor(color);
}
}