Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Creating a scene with the LowLevelPhysics2D API

Create and debug a scene that uses 2D physics.
Read time 1 minuteLast updated 10 days ago

Create and debug a scene that uses 2D physics with the
LowLevelPhysics2D
API.
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.

Topic

Description

Create a physics worldCreate a new world to add 2D physics objects to, or fetch the default world Unity automatically creates.
Create a physics objectCreate a 2D physics body, then attach shapes to the body.
Add a spriteAdd a SpriteRenderer component to a GameObject that has a physics script attached.
Move a GameObjectConfigure a 2D physics script to update the Transform component of a GameObject.
Draw a debug visualization of objectsConfigure how Unity draws 2D physics objects in the Unity Editor or at runtime, and draw your own shapes.
Combine shapesTo combine physics shapes into a compound shape, create a composer using a
PhysicsComposer
object.
Connect objects with jointsCreate a connection or constraint between two physics objects.
Destroy objects and manage memoryDestroy a world, body, and shape when you no longer need them, and free up memory when necessary.

Additional resources