unity-physicscore2d-components

Documents PhysicsCore2D component authoring patterns for Unity, including Transform binding and owner-key destruction guards.

730|105|Updated Mar 4, 2017
One-click install
npx skills add https://github.com/Unity-Technologies/PhysicsExamples2D --skill unity-physicscore2d-components
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-physicscore2d-components
Source: https://github.com/Unity-Technologies/PhysicsExamples2D/tree/main/.claude/skills/unity-physicscore2d-components
Command: npx skills add https://github.com/Unity-Technologies/PhysicsExamples2D --skill unity-physicscore2d-components

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers face the challenge of authoring safe, reusable Unity components that wrap PhysicsCore2D objects, reducing boilerplate and guarding against incorrect destruction.

Core Features & Use Cases

  • Component authoring patterns enabling Transform binding, transform-change notifications, and owner-key destruction guards.
  • Worked examples including BasicPhysicsComponent and GearComponent demonstrating canonical lifecycle handling and integration with PhysicsWorld.
  • Guidance on designing components that can be used directly in scripts or as Unity components sharing the underlying PhysicsCore2D API.

Quick Start

Create a new Unity component using the patterns shown to wrap a PhysicsCore2D object and wire it to a Transform, with an owner key to guard destruction.

Frequently Asked Questions about unity-physicscore2d-components

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I author safe Unity components that wrap PhysicsCore2D objects?

To author safe Unity components wrapping PhysicsCore2D objects, apply component patterns for Transform binding, transform-change notifications, and owner-key destruction guards to prevent incorrect lifecycle teardown.

What is an owner-key destruction guard in Unity PhysicsCore2D?

An owner-key destruction guard is a pattern ensuring only authorized code destroys a PhysicsCore2D object, preventing unsafe teardown when multiple components share the same underlying API lifecycle.

How do I bind a Transform to a PhysicsCore2D component in Unity?

You bind a Transform by wiring the PhysicsCore2D component to the Unity Transform lifecycle, utilizing transform-change notifications to synchronize physics object positions with the GameObject.

Do I need PhysicsWorld to use PhysicsCore2D component authoring patterns?

Yes, integrating with PhysicsWorld is required, as demonstrated by worked examples like BasicPhysicsComponent and GearComponent which show canonical lifecycle handling within the broader Unity physics environment.

Can I use PhysicsCore2D components directly in scripts instead of as Unity components?

Yes, these component authoring patterns guide you in designing wrappers that can be used directly in scripts or as standard Unity components sharing the underlying PhysicsCore2D API.

Why does my PhysicsCore2D component break when the Transform changes?

Transform changes break PhysicsCore2D components if transform-change notifications are not implemented, requiring proper lifecycle binding patterns to correctly synchronize the physics object during movement.