Version: Unity 6.0 (6000.0)
LanguageEnglish
  • C#

PolygonCollider2D

class in UnityEngine

/

Inherits from:Collider2D

/

Implemented in:UnityEngine.Physics2DModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Collider for 2D physics representing an arbitrary polygon defined by its vertices.

Additional resources: BoxCollider2D, CircleCollider2D, EdgeCollider2D.

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.

Public Methods

Method Description
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.

Inherited Members

Properties

PropertyDescription
enabledEnabled Behaviours are Updated, disabled Behaviours are not.