Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Physics 2D Profiler module reference

Use the Physics 2D Profiler module to analyze the performance of 2D physics in your application.
Read time 12 minutesLast updated 13 days ago

The Physics 2D Profiler module displays information about the physics that the physics system has processed in your project's scene. This information can help you diagnose and resolve performance issues or unexpected discrepancies related to the physics in your project’s scene.

Profiler window with the Physics 2D module selected.

To open the Profiler window, go to menu: Window > Analysis > Profiler. For more information on how to use the Profiler window, refer to Getting started with the Profiler window.

Chart categories

The Physics 2D Profiler module's chart is divided into the following categories:

Chart

Description

Total ContactsThe total number of contacts that were present in this frame. This includes both collision and trigger contacts.
Total ShapesThe total number of physics shapes that were present in this frame. Different Collider2D produce different amounts of physics shapes ranging from one to unlimited. You can get the shape count and retrieve the physics shapes to determine this for any Collider2D.
Total QueriesThe total number of queries that were called this frame. This includes queries such as Physics2D.Raycast, Physics2D.OverlapPoint etc.
Total CallbacksThe total number of OnCollisionEnter2D, OnCollisionStay2D, OnCollisionExit2D, OnTriggerEnter2D, OnTriggerStay2D and OnTriggerExit2D callbacks that were called in this frame.
Total JointsThe total number of any Joint2D that were present in this frame.
Total BodiesThe total number of Rigidbody2D that were present in this frame.
Awake BodiesThe total number of Rigidbody2D that were both awake (not sleeping) and were present in this frame.
Dynamic BodiesThe total number of Rigidbody2D with a Dynamic body type that were present in this frame.
Continuous BodiesThe total number of Rigidbody2D with a Continuous collision detection mode that were present in this frame.
Physics Used MemoryThe total amount of persistent memory used exclusively by the 2D physics system. This includes both the core engine and the memory used by each physics component, but doesn't include the temporary memory used in this frame.
Click on the frame chart window or select a captured frame in the chart graph to track selected categories. To change the order of the categories in the chart, drag them in the chart's legend. You can also click a category's colored legend to toggle its display. Refer to the module details pane for more information about the selected statistics.

Module details pane

When you select a frame in the Physics 2D Profiler module, the details pane displays detailed information about the physics in your project’s scene. The details pane is sorted by category, where each category exists on a single line.
The following reference table describes the statistics available, plus its corresponding profiler counter, and availability in release builds. The profiler counters are always available in the Editor and in development builds. This information is also available via the ProfilerRecorder API and in the Profiler Module Editor so you can add them to a custom Profiler module.

Physics Used Memory

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total amount of persistent memory used exclusively by the 2D physics system. This includes both the core engine and the memory used by each physics component, but doesn't include temporary memory used in this frame.Physics Used Memory 2DNo
RelativeThe relative percentage of memory used by the 2D physics system compared to the overall memory usage of Unity.N/AN/A

Bodies

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total number of Rigidbody2D that were present in this frame.Total BodiesNo
AwakeThe number of Rigidbody2D that were both awake (not sleeping) and were present in this frame. Note that a Rigidbody2D with a Static body type is always asleep.Awake BodiesNo
AsleepThe number of Rigidbody2D that were both sleeping (not awake) and were present in this frame. Note that a Rigidbody2D with a Static body type is always asleep.Asleep BodiesNo
DynamicThe number of Rigidbody2D with a Dynamic body type that were present in this frame. Dynamic bodies take the most processing of all body types.Dynamic BodiesNo
KinematicThe number of Rigidbody2D with a Kinematic body type that were present in this frame. Kinematic bodies have minimal processing.Kinematic BodiesNo
StaticThe number of Rigidbody2D with a Static body type that were present in this frame. Static bodies take the least processing of all body types.Static BodiesNo
DiscreteThe number of Rigidbody2D with a Discrete collision detection mode that were present in this frame. Discrete bodies are far less performance-intensive than when using Continuous collision detection mode.Discrete BodiesNo
ContinuousThe number of Rigidbody2D with a Continuous collision detection mode that were present in this frame. Continuous bodies are much more performance-intensive than when using Discrete collision detection mode..Continuous BodiesNo

Shapes

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total number of physics shapes that were present in this frame. Different Collider2D produce different amounts of physics shapes ranging from one to unlimited. You can get the shape count and retrieve the physics shapes to determine this for any Collider2D.Total ShapesNo
AwakeA physics shape is awake if it is attached to a Rigidbody2D that is awake. This is the number of physics shapes that were both awake (not sleeping) and were present in this frame.Awake ShapesNo
AsleepA physics shape is asleep if it is attached to a Rigidbody2D that is asleep. This is the number of physics shapes that were both sleeping (not awake) and were present in this frame.Asleep ShapesNo
DynamicA physics shape is Dynamic if it is attached to a Rigidbody2D with a Dynamic body type. This is the number of physics shapes that were both Dynamic and were present in this frame.Dynamic ShapesNo
KinematicA physics shape is Kinematic if it is attached to a Rigidbody2D with a Kinematic body type. This is the number of physics shapes that were both Kinematic and were present in this frame.Kinematic ShapesNo
StaticA physics shape is Static if it is attached to a Rigidbody2D with a Static body type. This is the number of physics shapes that were both Static and were present in this frame.Static ShapesNo

Queries

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total number of queries that were called this frame. This includes queries such as
Physics2D.Raycast
, and
Physics2D.OverlapPoint
.
Total QueriesNo
RaycastThe number of ray or line based queries that were called this frame. This includes queries such as
Physics2D.Raycast
and
Physics2D.Linecast
.
Raycast QueriesNo
ShapecastThe number of shape swept queries that were called this frame. This includes queries such as
Physics2D.BoxCast
,
Physics2D.CircleCast
, and
Collider2D.Cast
.
Shapecast QueriesNo
OverlapThe number of overlap queries that were called this frame. This includes queries such as
Physics2D.OverlapPoint
,
Physics2D.OverlapCircle
, and
Collider2D.OverlapCollider
.
Overlap QueriesNo
IsTouchingThe number of contact touching queries that were called this frame. This includes queries such as
Physics2D.IsTouching
,
Collider2D.IsTouching
,
Rigidbody2D.IsTouching
etc.
IsTouching QueriesNo
GetContactsThe number of contact retrieval queries that were called this frame. This includes queries such as
Physics2D.GetContacts
,
Collider2D.GetContacts
, and Rigidbody2D.GetContacts. Note that this doesn't include
Collision2D.GetContacts
which isn't a physics query.
GetContacts QueriesNo
ParticleThe number of queries that the Particle System called this frame. This is used when the Particle System module is configured to contact 2D physics colliders and is entirely controlled by the Particle System. Note that this can have a high impact on performance, but is also very efficient to process.Particle QueriesNo

Contacts

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total number of contacts that were present in this frame. This includes both Collision and Trigger contacts. Processing and solving contacts can take a long time to process.Total ContactsNo
AddedThe number of contacts that were added in this frame. This includes both Collision and Trigger contacts. Adding too many contacts in a single frame can cause performance spikes.Added ContactsNo
RemovedThe number of contacts that were removed in this frame. This includes both Collision and Trigger contacts. Removing contacts is fast and has minimum impact on performance.Removed ContactsNo
Broadphase UpdatesThe number of broadphase updates that were processed in this frame. A broadphase update occurs when physics shapes are added, removed or change in size. Broadphase updates are used to detect contact changes when two physics shapes potentially overlap and can result in a broadphase pair being created.Broadphase UpdatesNo
Broadphase PairsThe number of broadphase pairs that were processed in this frame. A broadphase pair is created when a broadphase update results in a potential overlap of two physics shapes. A broadphase pair is then processed and the result will be a new contact or it will be ignored if the physics shapes are not configured to contact each other.Broadphase PairsNo

Callbacks

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total number of OnCollisionEnter2D, OnCollisionStay2D, OnCollisionExit2D, OnTriggerEnter2D, OnTriggerStay2D and OnTriggerExit2D callbacks that were called in this frame.Total CallbacksNo
Collision EnterThe number of OnCollisionEnter2D callbacks that were called in this frame.Collision EnterNo
Collision StayThe number of OnCollisionStay2D callbacks that were called in this frame.Collision StayNo
Collision ExitThe number of OnCollisionExit2D callbacks that were called in this frame.Collision ExitNo
Trigger EnterThe number of OnTriggerEnter2D callbacks that were called in this frame.Trigger EnterNo
Trigger StayThe number of OnTriggerStay2D callbacks that were called in this frame.Trigger StayNo
Trigger ExitThe number of OnTriggerExit2D callbacks that were called in this frame.Trigger ExitNo

Solver

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

World CountThe total number of physics scene that were present in this frame. Each physics scene contains a physics world that can be simulated independently of any other physics world. Having a lot of worlds isn't a performance issue because it only occupies memory and doesn't perform any work unless it is simulated.Solver World CountNo
Simulation CountThe number of times all physics scene were simulated either by Unity automatically, by calling Physics2D.Simulate or by directly calling PhysicsScene2D.Simulate.Solver Simulation CountNo
Discrete IslandsAn island is a connected graph of bodies connected via mutual joints or mutual contacts. Note that Static body types don't connect islands. The number of contact islands solved when handling the discrete solving step.Solver Discrete IslandsNo
Continuous IslandsAn island is a connected graph of bodies connected via mutual joints or mutual contacts. Note that Static body types don't connect islands. This is the number of islands solved when handling the continuous solving step. Solving continuous islands is a performance-intensive process and involves multiple iterations that require islands to be regenerated and reprocessed. Only a Rigidbody2D with a Continuous collision detection mode will result in this additional continuous island being formed and processed.Solver Continuous IslandsNo

Transform Sync

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

Sync CallsThe total number of Transform sync calls that were called in this frame. A Transform sync (known as a Transform Read) involves checking if any Transforms have changed and if so, the Transform poses are read and cause any Rigidbody2D or Collider2D to be updated. Transforms should not be changed when using physics components however sometimes this is necessary but should be avoided due to potential performance issues if performing too many. Any movements should be performed by using the Rigidbody2D API.

The physics system will perform a single Transform sync as the first part of performing a simulation step so this will always be at least one if a simulation occurred (see Simulation Count above). The physics system will also perform a single Transform sync per-frame if it is handling any Rigidbody2D interpolation.

Additional calls are shown if either Physics2D.AutoSyncTransforms is active (inactive by default) or if Physics2D.SyncTransforms is called although both of these should be avoided as they can both have a severe impact on performance.
Total Transform Sync CallsNo
Sync BodiesThe number of Rigidbody2D that were affected by a Transform sync. This should be kept to a minimum, preferably zero.Transform Sync BodiesNo
Sync CollidersThe number of Collider2D that were affected by a Transform sync. This should be kept to a minimum, preferably zero.Transform Sync CollidersNo
Parent Sync BodiesThe number of Rigidbody2D that were affected by a Transform sync caused by reparenting a Transform.. This should be kept to a minimum, preferably zero.Transform Parent Sync BodiesNo
Parent Sync CollidersThe number of Collider2D that were affected by a Transform sync caused by reparenting a Transform. This should be kept to a minimum, preferably zero.Transform Parent Sync CollidersNo

Joints

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

TotalThe total number of any Joint2D that were present in this frame. Solving joints can become expensive so these should be kept to a minimum.Total JointsNo

Timings

Note
All timings are summed over all physics worlds (see World Count). The number of times any timing was sampled is shown in square brackets after the timing itself. Effectively the timing can be divided by the World Count value to give an average time.

Statistic

Description

Corresponding Profiler Counter (exact name)

Available in Release Players?

SimThe total amount of time spent handling a full simulation step. This can be called by Unity automatically, by calling Physics2D.Simulate or by directly calling PhysicsScene2D.Simulate. This time includes all the stages involved in completing a simulation step including Transform Sync (read), Calculating Contacts, Integration, Solving Contacts and Joints, Transform Write and Contact Callbacks.N/AN/A
SyncThe total amount of time spent processing Transform Sync (see Sync Calls).N/AN/A
StepThe total amount of time spent processing simulation steps. This time includes only the core stages involved in completing a simulation step including Calculating Contacts, Integration, Solving Contacts and Joints.N/AN/A
WriteThe total amount of time spent processing Transform write. This happens during the end of the simulation step where body poses are read and written back to the Transform system.N/AN/A
CallbacksThe total amount of time spent processing all callbacks (see Total Callbacks).N/AN/A

Additional resources