Note: This documentation is about writing C# scripts using the Unity.U2D.Physics API. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to 2D physics instead.
The Physics Core 2D API lets you create and control 2D physics objects in C# scripts. The API is based on version 3 of the Box2D physics system.
The API doesn’t interact with or affect the built-in Unity 2D physics components such as Rigidbody 2D and Collider 2D. The two systems are separate.
The API works on platforms that support compute shaders.
The API is compatible with the Universal Render Pipeline (URP), the High Definition Render Pipeline (HDRP), and the Built-In Render Pipeline.
The API has the following advantages over the standard 2D physics components such as Rigidbody 2D and Collider 2D:
The API lets you do the following for example:
There are no built-in components. You create physics objects directly in your scene. However you can use the API to expose sets of properties in the Inspector window of the Unity Editor that act like components. This allows you to configure properties similarly to Rigidbody 2D and Collider 2D components.
The Physics Core 2D API automatically draws a debug visualization of physics objects in the Scene view, Game view, and in development builds. You can also draw your own debug shapes. For more information, refer to Draw a debug visualization of Physics Core 2D API objects.
For example projects that use the Physics Core 2D API, refer to the PhysicsCore2D repository on GitHub.