I have a list and I want to assign its array to a property.
public void BuildMesh(List<Vector3> list){
mesh.vertices=list.ToArray();
}
Now the problems:
Do I have any option to prevent heap allocation?
EDIT: This is not a duplicate
Can't use IList<Vector3>
. The mesh is from a closed source API and needs Vector3[] so I can't assign IList<Vector3>
to it.
I think you're using Unity. If I'm right, try mesh.SetVertices(list)
which accept a List<Vector3>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With