The Composite Collider 2D componentA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary is a ColliderAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary that interacts with the 2D physics system. Unlike most colliders, it does not define an inherent shape. Instead, it merges the shapes of any Box Collider 2D or Polygon Collider 2D that you set it up to use. The Composite Collider 2D uses the vertices (geometry) from any of these Colliders, and merges them together into new geometry controlled by the Composite Collider 2D itself.
Both the Box ColliderA cube-shaped collider component that handles collisions for GameObjects like dice and ice cubes. More info
See in Glossary 2D and Polygon Collider 2D components have a Used By Composite checkbox. Select this checkbox to attach them to the Composite Collider 2D. These Colliders must also be attached to the same Rigidbody 2D as the Composite Collider 2D. When you enable Used by Composite, other properties disappear from that component, as they are now controlled by the attached Composite Collider 2D.
Refer to the CompositeCollider2D API documentation for more information about scripting with the Composite Collider 2D.
Property | Function |
---|---|
Density | Change the density to change the mass calculations of the GameObject’s associated RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info See in Glossary 2D. If you set the value to 0, its associated Rigidbody 2D ignores the Collider 2D for all mass calculations, including centre of mass calculations. Note that this option is only available if you have enabled Use Auto Mass in the associated Rigidbody 2D component. |
Material | A Physics Material 2DUse to adjust the friction and bounce that occurs between 2D physics objects when they collide More info See in Glossary that determines the 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 | Check this box if you want the Composite Collider 2D to behave as a trigger (see overview documentation on Colliders to learn more about triggers). |
Used by Effector | Check this box if you want the Composite Collider 2D to be used by an attached Effector 2D component. |
Offset | Set the local offset of the Collider 2D geometry. |
Geometry Type | When merging Colliders, the vertices from the selected Colliders are composed into one of two different geometry types. Use this drop-down to set the geometry type to either Outlines or Polygons. |
Outlines | Produces a Collider 2D with hollow outlines, identical to what the Edge Collider 2D produces. |
Polygons | Produces a Collider 2D with solid polygons, identical to what the Polygon Collider 2D produces. |
Generation Type | The method used to control when geometry is generated when either the Composite Collider 2D is changed, or any of the Colliders it is composing is changed. |
Synchronous | When a change is made to the Composite Collider 2D or any of the colliders it is using, Unity generates new geometry immediately. |
Manual | New geometry generation happens only when you request it. To request generation, either call the CompositeCollider2D.GenerateGeometry script API, or click the Regenerate Geometry button that appears under the selection. |
Vertex Distance | Set a value for the minimum spacing allowed for any vertices gathered from Colliders being composed. Any vertex closer than this limit is removed. This allows control over the effective resolution of the vertex compositing. |
Edge Radius | Controls a radius around edges, so that vertices are circular. This results in a larger Collider 2D with rounded convex corners. The default value for this setting is 0 (no radius). This only works when the Geometry Type is set to Outlines. |
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.