Login Register
Everyday Commands: Managing Your Project

Delete Commands for Safe Removal

Estimated reading: 0 minutes 7 views

Delete commands safely remove GameObjects, components, and assets. Safety is key — multiple checks prevent accidental deletions.

Key commands:

  • object.delete — Removes a GameObject and all its children and components.
  • component.remove — Removes one specific component, leaving the object intact.
  • component.remove_all — Removes all instances of a component type.
  • cleanup — Various cleanup operations.

Safety features:

  • Verification first: Vex verifies the target exists before deleting. No silent failures.
  • Dry-run for files: file.delete simulates by default — you see what would happen before anything is removed.
  • Protected paths: Files in .git, Library, Temp, Logs cannot be deleted under any circumstances.
  • Containment: Files outside project root cannot be deleted.

Example: You say “Delete all objects with ‘Test’ in the name.” Vex:

  1. Calls object.find with pattern “Test”
  2. Lists found objects: “Found: TestCube, TestSphere, TestLight”
  3. Asks for confirmation
  4. After your okay, deletes each one
  5. Reports: “Deleted 3 objects. Scene now has 12 objects.”

Vex confirms before bulk deletes. That extra step prevents regret.

Component removal:

Sometimes you want to remove a component without deleting the entire object. component.remove handles this — specify the target object and the component type. The object stays in the scene with all its other components intact. component.remove_all removes every instance of a given component type, which is useful when duplicate components have been accidentally added.

File deletion safety:

When deleting files (not scene objects), file.delete uses dry-run mode by default. The command simulates the deletion and reports what would happen. You see the file path, size, and confirmation that it exists before anything is removed. Only when you explicitly set dry_run: false does the file actually get deleted. Protected directories (.git, Library, Temp, Logs) cannot be deleted under any circumstances.

The cleanup command:

The cleanup command performs various housekeeping operations depending on the parameters you provide. It can remove orphaned objects, clean up empty GameObjects, or perform other tidying tasks that help keep your scene organized during intensive development sessions.

Verification before deletion:

Vex always follows the DAP protocol before deleting: discover the target first, verify it exists, confirm with you if multiple objects match, then delete one at a time with verification after each removal. This structured approach prevents the frustration of accidentally removing the wrong object from your scene.

Share this Doc

Delete Commands for Safe Removal

Or copy link

CONTENTS
Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot Avatar
What can I help you with?