unity-physicscore2d-destructor-api

Provides the Unity 6000.5 PhysicsCore2D PhysicsDestructor API reference with signatures and documentation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unity 6000.5's PhysicsCore2D API post-dates most AI training data, so code assistants often hallucinate member names or signatures when working with PhysicsDestructor. This Skill supplies the authoritative, auto-generated API surface so generated code compiles against the real API.

Core Features & Use Cases

  • Complete API Reference: Lists every method, property, and nested type of PhysicsDestructor, including Fragment, Slice, FragmentGeometry, FragmentResult, and SliceResult.
  • Exact Signatures: Provides parameter names, types, return values, and disposal requirements sourced from Unity 6000.5.0b9 documentation XML.
  • Use Case: When writing a Unity 2D destruction system that fragments a sprite's polygon geometry at impact points, consult this Skill to get the correct Fragment overload, allocator constraints, and disposal pattern instead of guessing.

Quick Start

Ask the AI to write Unity C# code that fragments polygon geometry using PhysicsDestructor and rely on this skill for the correct API signatures.

Frequently Asked Questions about unity-physicscore2d-destructor-api

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

FAQPage Schema
How do I fragment 2D geometry in Unity PhysicsCore2D?

Use PhysicsDestructor.Fragment with a FragmentGeometry target and a ReadOnlySpan of world-space fragment points. The method returns a FragmentResult containing broken and unbroken geometry, which must be disposed after use to avoid leaks.

How to slice 2D polygon geometry in Unity 6000.5?

Call PhysicsDestructor.Slice with the target FragmentGeometry, an origin point, and a non-zero translation vector defining the slice ray. The SliceResult returns leftGeometry and rightGeometry split by the infinite slice line.

Does PhysicsDestructor work with polygons that have a radius?

No. Target and mask polygons with a non-zero radius are ignored by both Fragment and Slice operations. You must provide polygon geometry with zero radius for fragmentation to process it.

Why does my Unity PhysicsDestructor code leak memory?

FragmentResult and SliceResult allocate native memory via the specified Unity.Collections allocator and must be disposed by calling Dispose() after use. Failing to dispose these results causes memory leaks.

What allocators can I use with PhysicsDestructor methods?

Fragment and Slice accept a Unity.Collections.Allocator parameter restricted to persistent or temporary-style allocators as documented. The chosen allocator governs the lifetime of the returned native geometry results.