Unity 2D collider debug view
Reveal unselected 2D colliders in Unity Editor
Type | Debug tool |
---|---|
Engine | Unity |
Working period | Jan 2016 - May 2021 |
Description
A collection of components and editor scripts that allow the level designer to see the 2D collider of any object at any time, a feature not natively available in Unity
Features
- Always show 2D collider, even when the object is not selected (disable when you want)
- Support rotating and scaling the object or a parent
- Customize the color of the collider lines
- For Edge and Polygon 2D colliders, edit points directly by coordinates (this feature is now native since Unity 5.4)
- Inspector button to Round all coordinates to 1/16 px
- Also works in 3D view (displays the 2D colliders in perspective)
Screenshots




Source code
The link above targets the parent directory of the scripts. The individual scripts are:
- EditBoxCollider2D.cs : show a BoxCollider2D
- EditEdgeCollider2D.cs and EditEdgeColliderEditor.cs : show and edit coordinates of an EdgeCollider2D
- EditPolygonCollider2D.cs and EditPolygonColliderEditor.cs : show and edit coordinates of a PolygonCollider2D
The scripts depend on GizmosUtil, a helper script I mainly wrote to support the 2D collider debug view.
Credits
The editing part is based on Raphael Marques’ answer on Stackoverflow.