- Home /
Weird issue with mesh.Clear()
Hi there,
I'm filling a custom mesh by code. Each frame I do the following:
myFilter.sharedMesh.Clear();
if (QuadsToRender>0){
// copy buffers to sharedMesh
...
}
When playing this works well. When I run this in EditMode (@ExecuteInEditor), the mesh won't render at all, no extra DrawCall for this mesh though I push tons of quads in it.
The strange thing: when I change the code and place the call to mesh.Clear() inside the condition to clear only when drawing something, it works - the mesh shows up. It seems that calling Clear() flags the mesh to be empty internally and that this state does not change once there is something to render in it.
I really appreciate any help on this topic!
Thanks in advance
Jake
Answer by Jake-L · Mar 25, 2011 at 02:37 PM
After changing the way I mute unused quads the problem disappeared. Before I set triagles to zero, now I set the vertices to Vector3.zero.
Your answer
Follow this Question
Related Questions
How to prevent editor to set the scene dirty if a script changes a mesh (@ExecuteInEditMode) 1 Answer
Prevent Unity from serializing MeshFilter.mesh 1 Answer
Is there any way to reset the default meshes? 3 Answers
How can I modify the mesh in OnPostprocessModel? 2 Answers
Mesh memory leak error 0 Answers