Save a scene GameObject (and its children) as a Prefab asset. Examples: u asset prefab -s Player -p Assets/Prefabs/Player.prefab u asset prefab --source-id 12345 -p Assets/Prefabs/Enemy.prefab
(
ctx: typer.Context,
path: Annotated[str, typer.Option("--path", "-p", help="Output path (e.g., Assets/Prefabs/My.prefab)")],
source: Annotated[str | None, typer.Option("--source", "-s", help="Source GameObject name")] = None,
source_id: Annotated[int | None, typer.Option("--source-id", help="Source GameObject instance ID")] = None,
)
| 26 | @asset_app.command("prefab") |
| 27 | @handle_cli_errors |
| 28 | def asset_prefab( |
| 29 | ctx: typer.Context, |
| 30 | path: Annotated[str, typer.Option("--path", "-p", help="Output path (e.g., Assets/Prefabs/My.prefab)")], |
| 31 | source: Annotated[str | None, typer.Option("--source", "-s", help="Source GameObject name")] = None, |
| 32 | source_id: Annotated[int | None, typer.Option("--source-id", help="Source GameObject instance ID")] = None, |
| 33 | ) -> None: |
| 34 | """Save a scene GameObject (and its children) as a Prefab asset. |
| 35 | |
| 36 | Examples: |
| 37 | u asset prefab -s Player -p Assets/Prefabs/Player.prefab |
| 38 | u asset prefab --source-id 12345 -p Assets/Prefabs/Enemy.prefab |
| 39 | """ |
| 40 | context: CLIContext = ctx.obj |
| 41 | |
| 42 | if not source and source_id is None: |
| 43 | _exit_usage("--source or --source-id required", "u asset prefab") |
| 44 | |
| 45 | result = context.client.asset.create_prefab( |
| 46 | path=path, |
| 47 | source=source, |
| 48 | source_id=source_id, |
| 49 | ) |
| 50 | print_success(result.get("message", f"Prefab created: {path}")) |
| 51 | |
| 52 | |
| 53 | @asset_app.command("scriptable-object") |
nothing calls this directly
no test coverage detected