I am trying to make avatar game.But I have some problems.
If I key on the weapon. I can't change the sprite in the unity.
like this
left no key. right have the key.
I use this code
Demo > AtlasRegionAttacher
Code > AtlasRegionAttacher.cs
void Apply (SkeletonRenderer skeletonRenderer) {
atlas = atlasAsset.GetAtlas();
AtlasAttachmentLoader loader = new AtlasAttachmentLoader(atlas);
float scaleMultiplier = skeletonRenderer.skeletonDataAsset.scale;
var enumerator = attachments.GetEnumerator();
while (enumerator.MoveNext()) {
var entry = (SlotRegionPair)enumerator.Current;
var regionAttachment = loader.NewRegionAttachment(null, entry.region, entry.region);
regionAttachment.Width = regionAttachment.RegionOriginalWidth * scaleMultiplier;
regionAttachment.Height = regionAttachment.RegionOriginalHeight * scaleMultiplier;
regionAttachment.SetColor(new Color(1, 1, 1, 1));
regionAttachment.UpdateOffset();
var slot = skeletonRenderer.skeleton.FindSlot(entry.slot);
slot.Attachment = regionAttachment;
}
}
This problem happen at my projet.
I have to change player gloves, but my animation have open and colse hand animation.
This This problem led to not work.
I'm not fluent in English. Hope you don't mind. :whew: