First - the situation: In an editor script I am performing a preprocessing step on a mesh in a scene to remove polygons that will never be rendered. To do this I:
- Figure out what triangles will possibly be visible within a mesh.
- Make a new mesh and assign it to the sharedMesh on the object I'm examining.
- Fill out a new set of vertices, normals etc that contain only the visible vertices.
- Fill out all submesh sets of triangles that are in the visible subset on the new mesh.
While both the editor and game now only render the polygons I've left around, selecting the modified gameobject then shows the original mesh (highlighted in green as normal) rather than the reduced one. If I examine the mesh in the asset window, it does correctly show the reduced mesh, and it has the correct vertext count and so on.
My question then is, why is Unity still displaying the original mesh when I select the relevant Game Object? Is there some link to the original asset from which the mesh came which I can't see? If that is the case, to truly create a reduced mesh, would I need to actually save out a new asset and create a totally new mesh based on that?