gameobject-destroy

Destroy a target GameObject and all its descendants in a Unity scene or prefab.

Updated Feb 4, 2024
One-click install
npx skills add https://github.com/sprillion/gem_td --skill gameobject-destroy-sprillion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gameobject-destroy
Source: https://github.com/sprillion/gem_td/tree/main/SKILLS/gameobject-destroy
Command: npx skills add https://github.com/sprillion/gem_td --skill gameobject-destroy-sprillion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Destroy GameObject and all nested GameObjects recursively in opened Prefab or in a Scene. Use 'gameobject-find' tool to find the target GameObject first.

Core Features & Use Cases

  • Destroy a target GameObject and all nested children within an opened Prefab or active Scene.
  • Use the gameobject-find tool to locate the target before destruction.
  • Safely remove hierarchies to keep project clean and performant.

Quick Start

Use the gameobject-destroy tool by supplying a GameObjectRef to remove the target object and its descendants.

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 and all its children in a Unity scene?

To destroy a GameObject and all nested children in a Unity scene, you supply a GameObjectRef such as an instanceID or path. This recursively removes the target parent and its descendants to clean up the hierarchy.

Can I remove nested GameObjects from an opened Unity prefab?

Yes, you can remove nested GameObjects from an opened Unity prefab. The tool accepts a gameObjectRef input and recursively destroys the target object and its descendants within the prefab environment.

Do I need to find a GameObject before destroying it in Unity?

Yes, you need to locate the target GameObject first. The recommended workflow uses a gameobject-find tool to identify the target before supplying its gameObjectRef to destroy the object and its descendants.

What is the best way to clean up leftover objects after a prefab modification?

The best way to clean up leftover objects after a prefab modification is to recursively destroy the parent GameObject. This safely removes the target and all nested GameObjects to keep the project clean and performant.

What information is returned after destroying a Unity GameObject?

After destroying a Unity GameObject, the output returns the destroyed object's name, path, and instanceId. This confirms the recursive destruction of the target and its descendants within the scene or prefab.