Version: 2020.2
Multi-scene physics
3D Physics Reference

Physics Debug Visualization

Physics Debug Visualiser allows you to quickly inspect the 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
geometry in your SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
, and profile common physics-based scenarios. It provides a visualisation of which GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
should and should not collide with each other. This is particularly useful when there are many Colliders in your Scene, or if the Render and Collision Meshes are out of sync.

For further guidance on improving physics performance in your project, see documentation on the Physics Profiler.

To open the Physics Debug window in the Unity Editor, go to Window > Analysis > Physics Debugger.

Default Physics Debug Visualization settings and a Cube primitive
Default Physics Debug Visualization settings and a Cube primitive

From this window, you can customize visual settings and specify the types of GameObjects you want to see or hide in the visualizer.

Physics Debug window with fold-out options and overlay panel
Physics Debug window with fold-out options and overlay panel
The Physics Debug overlay panel
The Physics Debug overlay panel

Hide Selected Items is the default mode. This means that every item appears in the visualizer, and you need to tick the checkbox for each item to hide it. To change this to Show Selected Items, use the drop-down at the top of the window. This means that no items appear in the visualizer, and you need to tick the checkbox for each item to display it.

Property Function
Reset Click this button to reset the Physics Debug window back to default settings.
Hide Layers Use the dropdown menu to determine whether or not to display Colliders from the selected LayersLayers in Unity can be used to selectively opt groups of GameObjects in or out of certain processes or calculations. This includes camera rendering, lighting, physics collisions, or custom calculations in your own code. More info
See in Glossary
.
Hide Static Colliders Tick this checkbox to remove static Colliders (Colliders with no Rigidbody component) from the visualization.
Hide Triggers Tick this checkbox to remove Colliders that are also Triggers from the visualization.
Hide Rigidbodies Tick this checkbox to remove Rigidbody components from the visualization.
Hide Kinematic Bodies Tick this checkbox to remove Colliders with Kinematic Rigidbody components (which are not controlled by the physics engine) from the visualization. See documentation on Rigidbody components for more details.
Hide Sleeping Bodies Tick this checkbox to remove Colliders with Sleeping RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
components (which are not currently engaging with the physics engine) from the visualization. See documentation on Rigidbody components: Sleeping for more details.
Collider Types Use these options to remove specific Collider types from the physics visualization.
    Hide
    BoxColliders
Tick this checkbox to remove Box CollidersA cube-shaped collider component that handles collisions for GameObjects like dice and ice cubes. More info
See in Glossary
from the visualization.
    Hide
    SphereColliders
Tick this checkbox to remove Sphere CollidersA sphere-shaped collider component that handles collisions for GameObjects like balls or other things that can be roughly approximated as a sphere for the purposes of physics. More info
See in Glossary
from the visualization.
    Hide
    CapsuleColliders
Tick this checkbox to remove Capsule CollidersA capsule-shaped collider component that handles collisions for GameObjects like barrels and character limbs. More info
See in Glossary
from the visualization.
    Hide
    MeshColliders
    (convex)
Tick this checkbox to remove convex Mesh CollidersA free-form collider component which accepts a mesh reference to define its collision surface shape. More info
See in Glossary
from the visualization.
    Hide
    MeshColliders
    (concave)
Tick this checkbox to remove concave Mesh Colliders from the visualization.
    Hide
    TerrainColliders
Tick this checkbox to remove Terrain CollidersA terrain-shaped collider component that handles collisions for collision surface with the same shape as the Terrain object it is attached to. More info
See in Glossary
from the visualization.
Hide None Click Hide None to clear all filtering criteria and display all Collider types in the visualization.
Hide All Click Hide All to enable all filters and remove all Collider types from the visualization.
Colors Use these settings to define how Unity displays physics components in the visualization.
    Static
    Colliders
Use this color selector to define which color indicates static Colliders (Colliders with no Rigidbody component) in the visualization.
    Triggers Use this color selector to define which color indicates Colliders that are also Triggers in the visualization.
    Rigidbodies Use this color selector to define which color indicates Rigidbody components in the visualization.
    Kinematic
    Bodies
Use this color selector to define which color indicates Kinematic Rigidbody components (which are not controlled by the physics engine) from the visualization. See documentation on Rigidbody components for more details.
    Sleeping
    Bodies
Use this color selector to define which color indicates Sleeping Rigidbody components (which are not currently engaging with the physics engine) from the visualization. See documentation on Rigidbody components: Sleeping for more details.
    Variation Use the slider to set a value between 0 and 1. This defines how much of your chose color blends with a random color. Use this to visually separate Colliders by color, and to see the structure of the GameObjects.
RenderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
See in Glossary
Use these settings to define how Unity renders and displays the physics visualization.
    Transparency Use the slider to set the value between 0 and 1. This defines the transparency of drawn collisionA 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
geometry in the visualization.
    Force
    Overdraw
Normal render geometry can sometimes obscure Colliders (for example, a Mesh Collider plane underneath a floor).Tick the Force Overdraw checkbox to make the visualization renderer draw Collider geometry on top of render geometry.
    View
    Distance
Use this to set the view distance of the visualization.
    Terrain
    Tiles Max
Use this to set the maximum number of Terrain tiles in the visualization.

The overlay panel has further options:

The Physics Debug overlay panel
The Physics Debug overlay panel
Property Function
Collision Geometry Tick this checkbox to enable collision geometry visualization.
Mouse Select Tick this checkbox to enable mouse-over highlighting and mouse selection. This can be useful if you have large GameObjects obstructing each other in the visualizer.

Profiling

You can use Physics Debug to profile and troubleshoot physics activity in your game. You can customize which types of Colliders or Rigidbody components you can see in the visualiser, to help you find the source of activity. The two most helpful are:

To see active Rigidbody components only: To see only the Rigidbody components that are active and therefore using CPU/GPU resources, tick Hide Static Colliders and Hide Sleeping Bodies.

To see non-convex MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary
Colliders only:
Non-convex (triangle-based) Mesh Colliders tend to generate the most contacts when their attached Rigidbody components are very near a collision with another Rigidbody or Collider. To visualize only the non-convex Mesh Colliders, set the window to Show Selected Items mode, click the Select None button, then tick the Show MeshColliders (concave) checkbox.

Scripting API Reference

See Unity Scripting API Reference for:



  • 2017–06–01 Page amended

  • Physics Debug Visualization is a new feature in Unity 5.6

Multi-scene physics
3D Physics Reference