List the scenes registered in Build Settings (with enabled flag and GUID).
(
ctx: typer.Context,
json_flag: Annotated[
bool,
typer.Option("--json", help="Output as JSON"),
] = False,
)
| 151 | |
| 152 | @build_app.command("scenes") |
| 153 | def build_scenes( |
| 154 | ctx: typer.Context, |
| 155 | json_flag: Annotated[ |
| 156 | bool, |
| 157 | typer.Option("--json", help="Output as JSON"), |
| 158 | ] = False, |
| 159 | ) -> None: |
| 160 | """List the scenes registered in Build Settings (with enabled flag and GUID).""" |
| 161 | context: CLIContext = ctx.obj |
| 162 | try: |
| 163 | result = context.client.build.scenes() |
| 164 | if _should_json(context, json_flag): |
| 165 | print_json(result) |
| 166 | else: |
| 167 | scenes_list: list[dict[str, Any]] = result.get("scenes", []) |
| 168 | |
| 169 | if is_no_color(): |
| 170 | rows = [] |
| 171 | for i, s in enumerate(scenes_list): |
| 172 | enabled = "yes" if s.get("enabled") else "no" |
| 173 | rows.append([str(i), s.get("path", ""), enabled, s.get("guid", "")]) |
| 174 | _print_plain_table(["#", "Path", "Enabled", "GUID"], rows, f"Build Scenes ({len(scenes_list)})") |
| 175 | else: |
| 176 | from rich.table import Table |
| 177 | |
| 178 | table = Table(title=f"Build Scenes ({len(scenes_list)})") |
| 179 | table.add_column("#", style="dim", width=3) |
| 180 | table.add_column("Path", style="cyan") |
| 181 | table.add_column("Enabled") |
| 182 | table.add_column("GUID", style="dim") |
| 183 | for i, s in enumerate(scenes_list): |
| 184 | enabled = "[green]yes[/green]" if s.get("enabled") else "[red]no[/red]" |
| 185 | table.add_row(str(i), s.get("path", ""), enabled, s.get("guid", "")) |
| 186 | get_console().print(table) |
| 187 | except UnityCLIError as e: |
| 188 | _handle_error(e) |
nothing calls this directly
no test coverage detected