Make a Triangle instead of a "Rect"

Im (still) new and learning, so this is probably a stupid question.

Basically im able to make a rectangle on the screen like this:

Rect topLeft = new Rect(0, 0, Screen.width / 2, Screen.height / 2);

this will create a rectangle which I can use with touch input control.

So now I want some way to create a triangular touch region on the screen, sort of like this:

I havent found any “Triangle” “Shape” “Polygon”, only Rect…

Thanks.

You can simply create a polygon region either with:

Since the PolygonCollider2D is a component it need to be attached to a GameObject. You cah use the method OverlapPoint to test a point against the collider.

The ContainsPoint method shouldn’t require much more explanation than what you’ll find on the wiki page.