MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / gameobject_delete

Function gameobject_delete

unity_cli/cli/commands/gameobject.py:201–218  ·  view source on GitHub ↗

Destroy a GameObject from the active scene. Examples: u gameobject delete -n TempSpawn u gameobject delete --id 12345

(
    ctx: typer.Context,
    name: Annotated[str | None, typer.Option("--name", "-n", help="GameObject name")] = None,
    id: Annotated[int | None, typer.Option("--id", help="Instance ID")] = None,
)

Source from the content-addressed store, hash-verified

199@gameobject_app.command("delete")
200@handle_cli_errors
201def gameobject_delete(
202 ctx: typer.Context,
203 name: Annotated[str | None, typer.Option("--name", "-n", help="GameObject name")] = None,
204 id: Annotated[int | None, typer.Option("--id", help="Instance ID")] = None,
205) -> None:
206 """Destroy a GameObject from the active scene.
207
208 Examples:
209 u gameobject delete -n TempSpawn
210 u gameobject delete --id 12345
211 """
212 context: CLIContext = ctx.obj
213
214 if not name and id is None:
215 _exit_usage("--name or --id required", "u gameobject delete")
216
217 result = context.client.gameobject.delete(name=name, instance_id=id)
218 print_success(result.get("message", "GameObject deleted"))

Callers

nothing calls this directly

Calls 4

_exit_usageFunction · 0.90
print_successFunction · 0.90
deleteMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected