gameobject-destroy

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

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/PMK95/GridSquad --skill gameobject-destroy-pmk95
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gameobject-destroy
Source: https://github.com/PMK95/GridSquad/tree/main/GridSquadUnity/.agents/skills/gameobject-destroy
Command: npx skills add https://github.com/PMK95/GridSquad --skill gameobject-destroy-pmk95

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 automating scene edits through an AI assistant. This Skill destroys a target GameObject and all its nested children programmatically and returns confirmation details. ## Core Features & Use Cases - Recursive Destruction: Removes the target GameObject along with every nested child GameObject in one operation. - Flexible Targeting: Locates the target by instance ID, hierarchy path, name, asset path, or asset GUID via the gameObjectRef parameter. - Confirmation Output: Returns the destroyed GameObject's name, hierarchy path, and instance ID so you have a record of what was removed. - Use Case: While refactoring a Unity scene, ask the assistant to delete an obsolete UI panel by name; the Skill resolves the reference, calls Object.DestroyImmediate on the main thread, and reports back the destroyed object's details. ## Quick Start Ask the assistant to destroy the GameObject named "OldMenu" in the active 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 destroy a GameObject in a Unity scene from the command line?▼

Run unity-mcp-cli run-tool gameobject-destroy with a JSON input containing a gameObjectRef that identifies the target by instance ID, hierarchy path, or name. The tool destroys the GameObject and all nested children, then returns its name, path, and instance ID.

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 instance ID or hierarchy path. Then pass that reference as the gameObjectRef input to gameobject-destroy to remove it.

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

Yes, this operation destroys the target GameObject and all nested child GameObjects recursively. It works both in the currently opened Prefab and in the active Scene.

Why is unity-mcp-cli not found when running the destroy command?▼

The CLI is either not installed or not on your PATH. Install it globally with npm install -g unity-mcp-cli, or invoke it via npx unity-mcp-cli, and check the unity-initial-setup skill for detailed setup instructions.

What are the limitations of destroying GameObjects in Editor mode?▼

The operation uses Object.DestroyImmediate, which is required for Editor-mode operations but is unsafe at runtime in play mode. It only targets GameObjects in the opened Prefab or active Scene, not arbitrary project assets.