Note: This documentation is about writing C# scripts using the LowLevelPhysics2D API. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to 2D physics instead.
The LowLevelPhysics2D API lets you create and control 2D physics objects in C# scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary. 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 shadersA program that runs on the GPU. More info
See in Glossary.
The API is compatible with the Universal Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary (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 LowLevelPhysics2D API automatically draws a debug visualization of physics objects in the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary, Game view, and in development buildsA development build includes debug symbols and enables the Profiler. More info
See in Glossary. You can also draw your own debug shapes. For more information, refer to Draw a debug visualization of LowLevelPhysics2D API objects.
For example projects that use the LowLevelPhysics2D API, refer to the PhysicsCore2D repository on GitHub.