rjohnn ha scritto
if(att is Spine.MeshAttachment)
{
Spine.Attachment newMeshAtt = spriteCollectionAttachmentLoader.NewMeshAttachment(newSkin,spriteImageName,spriteImageName);
Spine.MeshAttachment NewMatt = newMeshAtt as Spine.MeshAttachment;
Spine.MeshAttachment oldMatt = att as Spine.MeshAttachment;
NewMatt.vertices = oldMatt.vertices;
NewMatt.UVs = oldMatt.UVs;
NewMatt.regionUVs = oldMatt.regionUVs;
NewMatt.Triangles = oldMatt.Triangles;
newSkin.AddAttachment(slotIndex, attName, NewMatt);
}
I've trying to get Spine Skin cloning working in order to easily switch out materials on spine objects. The post by rjohnn for cloning RegionAttachments works great. However, I'm finding Copying the MeshAttachment doesn't work. Not sure what the issue is, the code seems correct. Unity gives me this:
Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 198, VertexCount: 24
UnityEngine.Mesh:SetTriangles(Int32[], Int32)
Spine.Unity.MeshGeneration.ArraysSubmeshSetMeshGenerator:GenerateMesh(ExposedList1, Int32, Int32) (at Assets/Libraries/lib_unity_SlotsClient/Assets/Scripts/Slots/Spine/spine-unity/Mesh Generation/Arrays/ArraysSubmeshSetMeshGenerator.cs:134)
Spine.Unity.Modules.SkeletonPartsRenderer:RenderParts(ExposedList
1, Int32, Int32) (at Assets/Libraries/lib_unity_SlotsClient/Assets/Scripts/Slots/Spine/spine-unity/Modules/SkeletonRenderSeparator/SkeletonPartsRenderer.cs:78)
Spine.Unity.Modules.SkeletonRenderSeparator:HandleRender(Instruction) (at Assets/Libraries/lib_unity_SlotsClient/Assets/Scripts/Slots/Spine/spine-unity/Modules/SkeletonRenderSeparator/SkeletonRenderSeparator.cs:155)
Spine.Unity.SkeletonRenderer:LateUpdateInternal() (at Assets/Libraries/lib_unity_SlotsClient/Assets/Scripts/Slots/Spine/spine-unity/SkeletonRenderer.cs:464)
Spine.Unity.SkeletonRenderer:LateUpdate() (at Assets/Libraries/lib_unity_SlotsClient/Assets/Scripts/Slots/Spine/spine-unity/SkeletonRenderer.cs:269)
I've been trying to trace this back but can't find a solution so far, maybe someone out there knows the answer.
Nate ha scritto
Replace all of that with:
newSkin.AddAttachment(slotIndex, attName, att);
Seems incorrect, when I do this it only adds the existing attachments without my material applied. Am I missing something here?
Thanks much,
Jason