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

Function build_scenes

unity_cli/cli/commands/build.py:153–188  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

151
152@build_app.command("scenes")
153def 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)

Callers

nothing calls this directly

Calls 7

_should_jsonFunction · 0.90
print_jsonFunction · 0.90
is_no_colorFunction · 0.90
get_consoleFunction · 0.90
_handle_errorFunction · 0.90
scenesMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected