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);

}

 

posted on 2017-02-21 23:13  wantnon  阅读(3867)  评论(0编辑  收藏  举报

导航