Polyline rendering after all points have been removed

  • updated

Image 820

So I'm drawing a Polyline with the mouse, and when releasing the mouse I do


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:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Freya Holmér creator

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 

UpdateMesh( force: true )

after you've cleared the points