Skip to content

Commit

Permalink
[unity] Fix MeshGenerator unnecessarily disposing buffer objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
pharan committed Oct 18, 2018
1 parent 8d74ef0 commit 2782804
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,10 @@ public void Begin () {
public void AddSubmesh (SubmeshInstruction instruction, bool updateTriangles = true) {
var settings = this.settings;

if (submeshes.Count - 1 < submeshIndex) {
submeshes.Resize(submeshIndex + 1);
}
int newSubmeshCount = submeshIndex + 1;
if (submeshes.Items.Length < newSubmeshCount)
submeshes.Resize(newSubmeshCount);
submeshes.Count = newSubmeshCount;
var submesh = submeshes.Items[submeshIndex];
if (submesh == null)
submeshes.Items[submeshIndex] = submesh = new ExposedList<int>();
Expand Down

0 comments on commit 2782804

Please sign in to comment.