Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PolygonCollider2D

Collider for 2D physics representing an arbitrary polygon defined by its vertices.
Read time 10 minutesLast updated 4 days ago

Definition

public sealed class PolygonCollider2D : Collider2D

Remarks

Properties

Property

Description

autoTilingDetermines whether the PolygonCollider2D's shape is automatically updated based on a SpriteRenderer's tiling properties.
pathCountThe number of paths in the polygon.
pointsCorner points that define the collider's shape in local space.
useDelaunayMeshWhen the value is true, the Collider uses an additional Delaunay triangulation step to produce the Collider mesh. When the value is false, this additional step does not occur.

Methods

Method

Description

CreateFromSpriteCreate polygon shapes using the selected sprite.
CreatePrimitiveCreates as regular primitive polygon with the specified number of sides.
GetPathGets a path from the Collider by its index.
GetTotalPointCountReturn the total number of points in the polygon in all paths.
SetPathDefine a path by its constituent points.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.