gameobject-component-destroy

Destroy one or more components from a Unity GameObject via the unity-mcp-cli tool.

Updated May 20, 2026
One-click install
npx skills add https://github.com/Alltwice/Unity-3D-Project --skill gameobject-component-destroy-alltwice
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gameobject-component-destroy
Source: https://github.com/Alltwice/Unity-3D-Project/tree/main/.agents/skills/gameobject-component-destroy
Command: npx skills add https://github.com/Alltwice/Unity-3D-Project --skill gameobject-component-destroy-alltwice

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires unity-mcp-cli.

What problem does it solve? Removing components from Unity GameObjects through the editor UI is slow and hard to automate, especially when cleaning up multiple components across prefabs or scenes. This Skill lets an AI agent destroy specific components on a target GameObject programmatically through the Unity MCP CLI. ## Core Features & Use Cases - Batch Component Destruction: Destroy one or many components from a target GameObject in a single call using a ComponentRefList. - Null-Safe Iteration: Missing (null) components such as broken script references are automatically skipped since they cannot be destroyed. - Helpful Error Reporting: If no component matches, the tool throws an error that previews all available components on the GameObject. - Use Case: While refactoring a character prefab, identify obsolete components with 'gameobject-component-get', then destroy them all at once by passing their component references to this tool. ## Quick Start Ask the AI to destroy the specified components on a target GameObject by first finding it with gameobject-find and listing its components with gameobject-component-get, then running gameobject-component-destroy with the gameObjectRef and destroyComponentRefs.

Frequently Asked Questions about gameobject-component-destroy

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

FAQPage Schema
How do I remove a component from a GameObject in Unity with MCP?▼

Run the gameobject-component-destroy tool via unity-mcp-cli with a gameObjectRef identifying the GameObject and destroyComponentRefs listing the components to remove. Use gameobject-find and gameobject-component-get first to obtain accurate references.

How to destroy multiple components on a Unity GameObject at once?▼

Pass a ComponentRefList array in the destroyComponentRefs parameter containing each component's index, typeName, or instanceID. The tool iterates the GameObject's components and destroys every non-null component matching one of the references.

Can I destroy a missing or null script component in Unity?▼

No. Missing (null) components, such as broken script references, are skipped during iteration because they cannot be destroyed. Only non-null components matching the provided references are removed.

Why does gameobject-component-destroy throw a NotFoundComponents error?▼

The error occurs when none of the provided destroyComponentRefs match any component on the target GameObject. The error message includes a preview of all available components so you can correct the references.

What should I do if unity-mcp-cli is not found?▼

Install it globally with npm install -g unity-mcp-cli or invoke it through npx unity-mcp-cli. The unity-initial-setup skill contains detailed installation instructions.