unity, Gizmos.DrawMesh一个坑

错误写法(画不出来):

void OnDrawGizmos(){

  Mesh mesh=new Mesh();

  mesh.vertices=...

  mesh.triangles=...

  //mesh.RecalculateBounds()

  Gizmos.DrawMesh(mesh);

}

正确写法1:

void OnDrawGizmos(){

  Mesh mesh=new Mesh();

  mesh.vertices=...

  mesh.triangles=...

  mesh.normals=...

  //mesh.RecalculateBounds()

  Gizmos.DrawMesh(mesh);

}

正确写法2:

void OnDrawGizmos(){

  Mesh mesh=new Mesh();

  mesh.vertices=...

  mesh.triangles=...

  mesh.RecalculateNormals ();

   //mesh.RecalculateBounds()

  Gizmos.DrawMesh(mesh);

}

 

你可能感兴趣的:(unity, Gizmos.DrawMesh一个坑)