The Polygon Collider__ 2D__ component is a Collider for use with 2D physics. The Collider’s shape is defined by a freeform edge made of line segments, so you can adjust it to fit the shape of the SpriteA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
See in Glossary graphic with great precision. Note that this Collider’s edge must completely enclose an area (unlike the similar Edge Collider 2D).
Property | Function |
---|---|
MaterialAn asset that defines how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. More info See in Glossary |
A physics material that determines properties of collisionsA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a rigidbody component and is in motion. More info See in Glossary, such as friction and bounce. |
Is Trigger | Tick this box if you want the Collider to behave as a trigger. |
Used by Effector | Whether the Collider is used by an attached effector or not. |
Used by Composite | Tick this checkbox if you want this Collider to be used by an attached Composite Collider 2D. When you enable Used by Composite, other properties disappear from the Polygon Collider 2D component, because they are now controlled by the attached Composite Collider 2D. The properties that disappear from the Box Collider 2D are Material, Is Trigger, Used By Effector, and Edge Radius. |
Used by Collider | Check this box if you want the Box ColliderA cube-shaped collider component that handles collisions for GameObjects like dice and ice cubes. More info See in Glossary 2D to be used by an attached Composite Collider 2D component. |
Auto Tiling | Tick this checkbox if you have set the Draw Mode of the Sprite RendererA component that lets you display images as Sprites for use in both 2D and 3D scenes. More info See in Glossary component to Tiled. This enables automatic updates to the shape of the Collider 2D, meaning that the shape is automatically readjusted when the Sprite’s dimensions change. If you don’t enable Auto Tiling, the Collider 2D stays the same shape and size, even when the Sprite’s dimensions change. |
Offset | The local offset of the Collider geometry. |
Points | Non-editable information about the complexity of the generated Collider. |
The Collider can be edited manually but it is often more convenient to let Unity determine the shape automatically. You can do this by dragging a Sprite Asset from the Project view onto the Polygon Collider 2D component in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary.
You can edit the polygon’s shape by pressing the Edit Collider button in the Inspector. You can exit Collider edit mode by pressing the Edit Collider button again. While in edit mode, you can move an existing vertex by dragging when the mouse is over that vertex. If you shift-drag while the mouse is over an edge, a new vertex will be created at the mouse location. You can remove a vertex by holding down the ctrl/cmd key while clicking on it.
Note that you can hide the outline of the 2D move GizmoA graphic overlay associated with a GameObject in a Scene, and displayed in the Scene View. Built-in scene tools such as the move tool are Gizmos, and you can create custom Gizmos using textures or scripting. Some Gizmos are only drawn when the GameObject is selected, while other Gizmos are drawn by the Editor regardless of which GameObjects are selected. More info
See in Glossary while editing the Collider - just click the fold-out arrow on the Sprite Renderer component in the Inspector to collapse it.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.