RemDust

Hello guys ;)

I've got back to work on my character customization and I'm having a hard time with recreating a skin at runtime picking up a Sprite (ressources folder).

I get an error "Texture rectangle is out of bounds (0 + 240 > 212)"
Now 240 is my sprite length for both images, at least when I check for the size in my Spine images folder (for the default skin image) and in my Unity project ressources folder (for the to replace skin image).

I suppose Unity tells me that even if my original image is supposed to be 240 it's actually 212 for whatever reason and the new one is 240 ?
What am I doing wrong ? Is there something to do with my Spine exports atlas/material that converted the original size 240 to 212 ?


Thank you for any help :)

Bonus Question :
Once I've created my repacked skin how can I make it re-useable by other skeletons in the scene ?
I will need to create at runtime duplicates of my skeleton and rebuild the same customized skin :think:
RemDust
Posts: 147

Harald

Have you tried re-importing your assets via Assets-Reimport?
If that does not help: Could you please create a zipped package of a minimal Unity project that shows this problem and send it to contact@esotericsoftware.com?
Bonus Question :
Once I've created my repacked skin how can I make it re-useable by other skeletons in the scene ?
I will need to create at runtime duplicates of my skeleton and rebuild the same customized skin :think:
I'm not sure if I understood you correctly - but did you take a look at the "Mix and Match Equip" sample scene in "Spine Examples/Other Examples"? There you could have a look at the code in the classes EquipSystemExample.cs and especially EquipsVisualsComponentExample.cs at line 21:
void Start () {
equipsSkin = new Skin("Equips");

// OPTIONAL: Add all the attachments from the template skin.
var templateSkin = skeletonAnimation.Skeleton.Data.FindSkin(templateSkinName);
if (templateSkin != null)
equipsSkin.AddAttachments(templateSkin);

skeletonAnimation.Skeleton.Skin = equipsSkin;
RefreshSkeletonAttachments();
}
User avatar
Harald

Harri
Posts: 56


Return to Unity