I am developing the tool (editor window + editor tool) and I need to draw mesh in scene view window - sounds like trivial task, but I can’t find the way to make it work. I checked google and there are multiple similar questions, but there are no working solutions.
There is no method in Handles to draw mesh, Gizmos can be used only in OnDrawGizmos, I can’t find any extra utility, literally the only method is Graphics.DrawMesh. The problem is that mesh persists longer than one frame.
I need to draw some kind of “brush” preview, and when mouse moves this preview should follow the cursor, but currently it adds another preview every frame, while the previous one is still there until I press mouse (or somehting cause refresh, whatever causes it).
I tried to call Repaint(), EditorUtility.SetDirty(), EditorApplication.QueuePlayerLoopUpdate(), but then the rendered mesh is blinking and when I stop moving the cursor it just disappears.
What is the solution? I do not believe there is no reliable way to paint mesh in scene view.