- Изменено
hello. Image is broken when skin is replaced.
Hello.
I am going to replace the weapon.
No problem when using normal skeleton.
With SkeletonGraphic, the image is broken like a photo.
I would appreciate it if you could tell me the solution.
thank you.
my code:
Spine.Skin customSkin = skeletonGraphic.Skeleton.Skin ?? new Spine.Skin("WPChangeSkin");
int index = skeletonGraphic.Skeleton.FindSlotIndex(PlayerSpineData.weaponSlotName);
if (0 < index)
{
Material newMat = new Material(Shader.Find("UI/Default"));
Spine.Attachment attachment = skeletonGraphic.Skeleton.GetAttachment(index, PlayerSpineData.weaponSlotName);
var newAtt = attachment.GetRemappedClone(sprite, newMat);
customSkin.SetAttachment(index, PlayerSpineData.weaponSlotName, newAtt);
skeletonGraphic.Skeleton.SetSkin(customSkin);
skeletonGraphic.Skeleton.SetSlotsToSetupPose();
skeletonGraphic.LateUpdate();
}
Which version of the Spine-Unity runtime are you using (name of the unitypackage)? We have just recently fixed two issues related to skins and SkeletonGraphic, so if you are not yet using the latest 3.8 package spine-unity-3.8-2019-08-20.unitypackage
, please consider updating.
SkeletonGraphic has the limitation of a single material, you need to be sure that everything ends up in a single atlas page including clothes and weapons.
Still thanks very much for taking the time and effort! Knowing which words to copy for which circumstance is still honorable! :nerd: