title: How to use meshes with more than 64k vertices in Unity 2018.1
body: <p>I've heard that Unity supports 32-bit index buffer now. But when I try Unity 2018.1 I can't make it work.</p>
  
  <p>I built meshes in code like this:</p>
  
  <pre><code>    int nVertices = nx * ny;
      Vector3[] vertices = new Vector3[nVertices];
      Color[] colors = new Color[nVertices];
      for(int i = 0; i &lt; nx; i++) {
          float x = i * w / (nx - 1);
          for (int j = 0; j &lt; ny; j++) {
              float y = j * h / (ny - 1);
              int vindex = i * ny + j;
              vertices[vindex] = new Vector3(x, y, 0);
              float colorx = Mathf.Sin(x) / 2 + 0.5f;
              float colory = Mathf.Cos(y) / 2 + 0.5f;
              colors[vindex] = new Color(0, 0, 0, colorx * colory);
          }
      }
      List&lt;int&gt; triangles = new List&lt;int&gt;();
      for (int i = 1; i &lt; nx; i++) {
          for (int j = 1; j &lt; ny; j++) {
              int vindex1 = (i - 1) * ny + (j - 1);
              int vindex2 = (i - 1) * ny + j;
              int vindex3 = i * ny + (j - 1);
              int vindex4 = i * ny + j;
              triangles.Add(vindex1);
              triangles.Add(vindex2);
              triangles.Add(vindex3);
              triangles.Add(vindex4);
              triangles.Add(vindex3);
              triangles.Add(vindex2);
          }
      }
      Mesh mesh = new Mesh();
      mesh.SetVertices(vertices.ToList&lt;Vector3&gt;());
      mesh.SetIndices(triangles.ToArray(), MeshTopology.Triangles, 0);
      mesh.SetColors(colors.ToList&lt;Color&gt;());
  </code></pre>
  
  <p>My shader draws rainbow pattern according to vertex color's alpha value.</p>
  
  <p>256 x 256 grid is OK, but 512 x 512 grid only shows 1/4 of its area and many wrong triangles.</p>
  
  <p><a href="https://i.stack.imgur.com/n2ab2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/n2ab2.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/DxuaC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DxuaC.png" alt="enter image description here"></a></p>