Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MeshIntegratorWizard cannot run with insufficient materials for submeshes #1721

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/UniGLTF/Runtime/MeshUtility/MeshIntegrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void Push(MeshRenderer renderer)
BindPoses.Add(bindpose);
Bones.Add(bone);

for (int i = 0; i < mesh.subMeshCount; ++i)
for (int i = 0; i < mesh.subMeshCount && i < renderer.sharedMaterials.Length; ++i)
{
var indices = mesh.GetIndices(i).Select(x => x + indexOffset);
var mat = renderer.sharedMaterials[i];
Expand Down Expand Up @@ -193,7 +193,7 @@ public void Push(SkinnedMeshRenderer renderer)
Bones.Add(renderer.transform);
}

for (int i = 0; i < mesh.subMeshCount; ++i)
for (int i = 0; i < mesh.subMeshCount && i < renderer.sharedMaterials.Length; ++i)
{
var indices = mesh.GetIndices(i).Select(x => x + indexOffset);
var mat = renderer.sharedMaterials[i];
Expand Down