void HandleRender(SkeletonRendererInstruction instruction) { int rendererCount = partsRenderers.Count; if (rendererCount <= 0) { return; } if (copyPropertyBlock) { mainMeshRenderer.GetPropertyBlock(copiedBlock); } var settings = new MeshGenerator.Settings { addNormals = skeletonRenderer.addNormals, calculateTangents = skeletonRenderer.calculateTangents, immutableTriangles = false, // parts cannot do immutable triangles. pmaVertexColors = skeletonRenderer.pmaVertexColors, tintBlack = skeletonRenderer.tintBlack, useClipping = true, zSpacing = skeletonRenderer.zSpacing }; var submeshInstructions = instruction.submeshInstructions; var submeshInstructionsItems = submeshInstructions.Items; int lastSubmeshInstruction = submeshInstructions.Count - 1; int rendererIndex = 0; var currentRenderer = partsRenderers[rendererIndex]; for (int si = 0, start = 0; si <= lastSubmeshInstruction; si++) { if (submeshInstructionsItems[si].forceSeparate || si == lastSubmeshInstruction) { // Apply properties var meshGenerator = currentRenderer.MeshGenerator; meshGenerator.settings = settings; if (copyPropertyBlock) { currentRenderer.SetPropertyBlock(copiedBlock); } // Render currentRenderer.RenderParts(instruction.submeshInstructions, start, si + 1); start = si + 1; rendererIndex++; if (rendererIndex < rendererCount) { currentRenderer = partsRenderers[rendererIndex]; } else { // Not enough renderers. Skip the rest of the instructions. break; } } } // Clear extra renderers if they exist. for (; rendererIndex < rendererCount; rendererIndex++) { partsRenderers[rendererIndex].ClearMesh(); } }