Skip to content

Commit cc6706b

Browse files
committed
reduce a triple copy to a single copy
1 parent 40fd264 commit cc6706b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Assets/HoloToolkit/SpatialUnderstanding/Scripts/SpatialUnderstandingDll.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ public void CopyFrom(MeshFilter meshFilter, int meshID = 0, int lastUpdateID = 0
4949
if (meshFilter != null)
5050
{
5151
Transform = meshFilter.transform.localToWorldMatrix;
52-
Verts = new Vector3[meshFilter.sharedMesh.vertices.Length];
53-
Array.Copy(meshFilter.sharedMesh.vertices, Verts, Verts.Length);
54-
Normals = new Vector3[meshFilter.sharedMesh.normals.Length];
55-
Array.Copy(meshFilter.sharedMesh.normals, Normals, Normals.Length);
56-
Indices = new Int32[meshFilter.sharedMesh.triangles.Length];
57-
Array.Copy(meshFilter.sharedMesh.triangles, Indices, Indices.Length);
52+
53+
// Note that we are assuming that Unity's getters for vertices/normals/triangles make
54+
// copies of the array. As of unity 5.4 this assumption is correct.
55+
Verts = meshFilter.sharedMesh.vertices;
56+
Normals = meshFilter.sharedMesh.normals;
57+
Indices = meshFilter.sharedMesh.triangles;
5858
}
5959
}
6060
}

0 commit comments

Comments
 (0)