baking-type-cleanup-component

Track entity lifecycle across incremental Unity DOTS baking passes with ICleanupComponentData.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill baking-type-cleanup-component
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baking-type-cleanup-component
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/unity-dots/baking-type-cleanup-component
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill baking-type-cleanup-component

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevent stale or incorrect runtime/baking outputs by reliably tracking entity lifecycle events (creation, re-parenting, and destruction) across incremental baking passes.

Core Features & Use Cases

  • Lifecycle-aware cleanup component: Uses ICleanupComponentData together with [BakingType] so cleanup survives entity destruction while the primary baked component is stripped from the runtime world.
  • Destroyed-entity detection: Detects entities whose baked components disappeared but whose cleanup remains, then triggers recomputation for dependent parent-level data.
  • Re-parenting handling: Stores the previous Parent (or equivalent hierarchy reference) in the cleanup component and compares it to the current hierarchy to trigger correct updates.
  • Stale-growth prevention: Removes the cleanup component after processing to avoid accumulating old cleanup records over multiple baking passes.

Quick Start

Add a [BakingType]-tagged ICleanupComponentData cleanup struct, write it onto newly baked entities, and on each bake pass recompute impacted parent-dependent data when cleanup entities are found without the corresponding baked components anymore.

Frequently Asked Questions about baking-type-cleanup-component

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

FAQPage Schema
How do I track destroyed entities during Unity DOTS incremental baking?

Track destroyed entities in Unity DOTS incremental baking by attaching a [BakingType] cleanup component that survives entity destruction, allowing you to detect missing baked components and trigger recomputation for dependent parent-level data.

How do I recalculate compound bounds when child entities are re-parented in Unity ECS?

Recalculate compound bounds in Unity ECS by storing the previous Parent reference in a cleanup component, comparing it to the current hierarchy during baking, and triggering parent-level recomputation when discrepancies are detected.

Why do cleanup components accumulate stale data across multiple baking passes?

Cleanup components accumulate stale data across baking passes when they are not removed after processing. You must explicitly remove the cleanup component after recomputation to prevent old records from persisting and causing incorrect outputs.

Does [BakingType] prevent cleanup components from entering the runtime world in Unity DOTS?

Yes, applying the [BakingType] attribute prevents cleanup components from entering the runtime world in Unity DOTS by stripping them from the final runtime world, while still allowing the cleanup component to survive entity destruction within the baking world for lifecycle tracking.

What is the best way to handle entity lifecycle events in Unity ECS hierarchy baking?

The best way to handle entity lifecycle events in Unity ECS hierarchy baking is using an ICleanupComponentData cleanup pattern to track creation, re-parenting, and destruction across incremental baking passes, ensuring parent-derived data remains accurate.