gameobject-destroy

Destroys a GameObject and all nested children in a Unity Prefab or Scene.

Updated May 28, 2026
One-click install
npx skills add https://github.com/ishaansingh-ai/Mechanical-2D --skill gameobject-destroy-ishaansingh-ai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gameobject-destroy
Source: https://github.com/ishaansingh-ai/Mechanical-2D/tree/main/.claude/skills/gameobject-destroy
Command: npx skills add https://github.com/ishaansingh-ai/Mechanical-2D --skill gameobject-destroy-ishaansingh-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires unity-mcp-cli.

What problem does it solve? Removing GameObjects from a Unity Scene or Prefab manually through the editor is slow and error-prone, especially when targeting deeply nested hierarchies. This Skill deletes a target GameObject and all of its nested children recursively via the unity-mcp-cli command line. ## Core Features & Use Cases - Recursive Deletion: Destroys the target GameObject along with every nested child GameObject in one operation. - Flexible Targeting: Locate the GameObject by instanceID, hierarchy path, name, asset path, or asset GUID. - Structured Result: Returns the destroyed GameObject's name, hierarchy path, and instance ID for confirmation. - Use Case: While refactoring a Unity scene, you find an obsolete 'OldUI/Panel' hierarchy. Use this Skill to remove the entire branch programmatically without opening the editor hierarchy manually. ## Quick Start Ask the AI to destroy the GameObject named 'OldPanel' in the active Unity scene using the gameobject-destroy tool, after locating it with gameobject-find.

Frequently Asked Questions about gameobject-destroy

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

FAQPage Schema
How do I delete a GameObject in Unity from the command line?▼

Run unity-mcp-cli with the gameobject-destroy tool, passing a gameObjectRef that identifies the target by instanceID, hierarchy path, or name. The tool destroys the GameObject and all nested children recursively in the opened Prefab or active Scene.

How do I find a GameObject before destroying it in Unity?▼

Use the gameobject-find tool first to locate the target GameObject and obtain its reference. Then pass that reference as the gameObjectRef input to gameobject-destroy to remove it.

Does destroying a GameObject also delete its children in Unity?▼

Yes, this tool destroys the target GameObject and all nested GameObjects recursively. The entire hierarchy branch under the target is removed in a single operation.

What if unity-mcp-cli is not found when running the command?▼

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

Can I destroy a GameObject by its hierarchy path instead of instanceID?▼

Yes, the gameObjectRef accepts a path such as 'character/hand/finger' with priority 2, after instanceID. You can also use name, assetPath, or assetGuid as alternative identifiers.