• Unity
  • attachments at runtime

  • تم التحرير
Related Discussions
...

Hello! Question about loading attachments at runtime: there are some attachments I tinted in spine editor, when loaded at runtime the region attachments show up colored correctly, while mesh attachments show up with the texture color, untinted.
Is this intended?
I did this in a few cases to reduce the number of textures in the atlas, but since all the other attachments are loaded at runtime over a single template set into spine editor, we do the same for these (which loaded correctly when not using a template)

Hi!
This is not intended. Could you please tell us which versions of the Spine Editor and the Spine-Unity runtime you are using?

To clarify: these are the methods we are using:

Spine.Attachment templateAttachment = theSkin.GetAttachment(slotIndex, hatPart.template);
Spine.AtlasRegion atlasRegion = cachedAtlasRegions[hatPart.region];
Spine.Attachment newAttachment = templateAttachment.GetRemappedClone(atlasRegion, true, false, skeletonAnimation.SkeletonDataAsset.scale);
currentCustomSkin.SetAttachment(slotIndex, regionName, newAttachment);

Like Fainder said, these run-time cloned attachments are automatically correctly tinted for region attachments, but mesh attachments show up untinted.

Oh and we are using Spine 3.7 for both (Editor is 3.7.91 and Unity is Spine 3.7 2019 March 20th).


Ok well I fixed it manually on our end for now:

if (templateAttachment.GetType() == typeof(Spine.MeshAttachment))
{
    Spine.MeshAttachment newAttachmentCasted = (Spine.MeshAttachment)newAttachment;
    Spine.MeshAttachment oldAttachment = (Spine.MeshAttachment)templateAttachment;
    newAttachmentCasted.R = oldAttachment.R;
    newAttachmentCasted.G = oldAttachment.G;
    newAttachmentCasted.B = oldAttachment.B;
    newAttachmentCasted.A = oldAttachment.A;
}

Thanks for the additional info pixilestudios. I will have a look if I can quickly reproduce this, otherwise I will get back to you in request for a reproduction package.


Unfortunately, I could not reproduce your problem, but I do see this commit here which seems to have adressed such a problem, its from Oct 1st 2018 though. Are you sure you are using Spine 3.7 from 2019 March 20th?

If yes, could you please send us a minimal reproduction package to contact@esotericsoftware.com that shows your problem? Thanks!