Skills

Create 2d Physics

Creates and fixes Unity 2D physics in both systems, 2D Physics Core and the legacy...

Install

npx skills add Unity-Technologies/skills --skill create-2d-physics -g -a claude-code -y
Category
Media
Updated
5d ago
License
See repository
Context cost
Mediumabout 2,547 tokens
Runs scripts
No, instructions only

What it does

Creates and fixes Unity 2D physics in both systems, 2D Physics Core and the legacy Rigidbody 2D system. Use when the user asks about any 2D physics task, even if neither system is named. Not for 3D physics.

Create and fix Unity 2D physics

Do not weigh 3D physics options. If evidence shows the user means 3D, say so and stop.

Important

  • Use the unity cli (unity command --format json) and the unity-cli and unity-pipeline skills for each step.
  • Before making changes, establish a baseline of the current behavior so you can tell whether a later result is actually caused by your change.
  • Create a restore point you can roll back to if your changes fail.
  • Do only what's asked. Don't change unrelated assets or files.
  • Avoid long explanations.
  • Verify runtime behaviour with temporary Debug.Log lines, then remove them, because the user didn't ask for logging and leftover lines clutter their script and console. Don't build settle-detection or permanent logging they didn't ask for. See Final step.
  • Never reflect over types to discover an API, fetch the member page instead. The system probe is the one exception.

Passing C# to script eval

script eval compiles a statement block, not a file, so write the code without using directives and with fully qualified types. return what you want to read; it arrives at data.result.result. If the code doesn't compile, look up the error here:

ErrorCauseFix
CS0210A using directive, which the compiler reads as a resource-disposal statementRemove the directive and qualify the types
CS0246 / CS0103An unqualified type, such as Rigidbody2D or PhysicsWorldUse the full name, such as UnityEngine.Rigidbody2D or Unity.U2D.Physics.PhysicsWorld
CS0104A bare Object, which is ambiguous with objectUse UnityEngine.Object

Step 0: Which physics system

Unity has two 2D physics systems. They share no code and never interact. Identify which one before writing any physics code, an answer from the wrong system compiles, runs, and does nothing.

Read the whole SKILL.md on GitHub

More in Media