Skip to content

Commit

Permalink
Update MeshUtils, set colors after setting verticies.
Browse files Browse the repository at this point in the history
Update MeshUtils, set colors after setting vertices, Unity will throw an error when there are more colors than vertices.
  • Loading branch information
maxartz15 committed Nov 26, 2019
1 parent 279edb1 commit 947eb6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/MA_ToolBox/MA_Utilities/MeshUtils/MA_MeshUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public static Mesh MA_DuplicateMesh(Mesh mesh)
{
name = mesh.name,
bounds = mesh.bounds,
colors = mesh.colors,
subMeshCount = mesh.subMeshCount
};

Expand All @@ -55,6 +54,7 @@ public static Mesh MA_DuplicateMesh(Mesh mesh)
newMesh.SetNormals(new List<Vector3>(mesh.normals));
newMesh.SetUVs(0, new List<Vector2>(mesh.uv));
newMesh.SetTangents(new List<Vector4>(mesh.tangents));
newMesh.SetColors(new List<Color>(mesh.colors));

return newMesh;
}
Expand Down

0 comments on commit 947eb6f

Please sign in to comment.