So I am setting up a prototypie thing for my game and I wanted to save my mesh bc it really huge(about 16,000,000 vertices) and instead of 8 for loops at the start of the game I then only had 2 but my arrays throw a NullReferenceException when trying to set.
public float[,] verts = new float[1, 3];
public int[] tris = new int[1];
public void SetValues(Vector3[] vertices, int[] triangles)
{
verts =
new float [vertices.Length, 3];
tris =
new int [triangles.Length];
for(int i = 0; i < verts.Length; i++)
{
verts[i, 0] =
vertices[i].x;
verts[i, 1] =
vertices[i].y;
verts[i, 2] =
vertices[i].z;
}
for(int i = 0; i < tris.Length; i++)
{
tris[i] = triangles[i];
}
}
I am in complete loss of what's causing the problem