Polyline rendering after all points have been removed
So I'm drawing a Polyline with the mouse, and when releasing the mouse I do
_poly.SetPoints(Array.Empty())
to remove all points, but the polyline is not updated. I have tried setting
_poly.meshOutOfDate = true
but this make no difference.
[...]
Ok so I figured it out. Polyline does not redraw unless there is "valid points", meaning at least two points in the array. I have to disable the Polyline, and re-enable it only when I have at least two points.
Would make more sense for me that setting `points` array to 0 or 1 element would remove anything draw earlier.
Reporting a bug? please specify Unity version:
2022.3.19f1
Reporting a bug? please specify Shapes version:
4.3.1
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
hmm, that is tricky yeah, because the mesh updating is deferred to avoid having multiple mesh updates called on the same frame, but if there's no vertices then OnPreCull won't get called.
I could maybe add a special case RemoveAllPoints().
A workaround for now is to call
after you've cleared the points