2D collider debug view

Reveal unselected 2D colliders in Unity Editor

EngineUnity
LanguageC#

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 integrated in Unity 5.4)

Screenshots

Unity scene in 2D mode with collider view activeUnity scene in 3D mode with collider view enabled
EditBoxCollider2D component in Unity Inspector

EditBoxCollider2D component in Unity Inspector

EditEdgeCollider2D component allows editing of edge coordinates and permanent viewing of the collider

EditEdgeCollider2D component allows to edit coordinates and always view the edge

Source code

The link above targets the parent directory of the scripts. The individual scripts are:

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, and the view part is an original script dependent on my own GizmosUtil.