Drawing shapes on a canvas

Hello,

I’m in a bit of a pickle because I am using an asset that requires my canvas use Overlay, but I also need to render a 2d octagon shape to the screen (and also be able to manipulate the vertices through code).

I can get it all working if I use Camera mode (by having a octagon mesh and accessing its .vertices[ ] array. But then the other asset doesn’t work.

So I need to use Overlay mode, but I don’t know how to render a 2d shape to it.

Thanks :smile:

Have you considered this asset?

If you really want to roll your own, I think you can do it using CanvasRenderer, as discussed here. But Patrick has done a great job with the above asset, and it may be well worth the price to let him be the expert on these poorly-documented Canvas tricks.

I discovered the UI Polgyon script in Unity Extensions which does exactly what I need out of the box. Perfect!.

Thanks anyway

1 Like

UIPolygon uses VertexHelper and OnPopulateMesh which aren’t in 4.7, what’s the alternative?