Skip to content

Commit d943c14

Browse files
committed
Fix for IndexOutOfRangeException
This exception occurs when accessing the UV array when the Submesh count > 4
1 parent 8b06bdf commit d943c14

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Assets/Plugins/MeshDebugger/Editor/MeshInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public void Update()
7777
Set(ref m_Colors, m_Mesh.colors);
7878
Set(ref m_BoneWeights, m_Mesh.boneWeights);
7979
Resize(ref m_UVs, 4);
80-
for (int i = 0; i < m_MeshSubmeshCount; i++)
80+
//uvs are resized to be no more than 4, but if SubMeshCount > 4 then IndexOutOfRangeException would be thrown
81+
for (int i = 0; i < m_MeshSubmeshCount && i < m_UVs.Length; i++)// extra range check fixes this
8182
{
8283
m_Mesh.GetUVs(i, m_UVs[i]);
8384
}

0 commit comments

Comments
 (0)