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

Function screenshot

unity_cli/cli/commands/screenshot.py:17–87  ·  view source on GitHub ↗

Capture screenshot from GameView, SceneView, or Camera. By default captures a single screenshot. Use --burst for multi-frame capture. Sources (capture mode): game - GameView (async, requires editor focus) scene - SceneView camera - Camera.Render (sync, focus-independen

(
    ctx: typer.Context,
    burst: Annotated[
        bool,
        typer.Option("--burst", help="Burst mode: capture multiple frames in rapid succession"),
    ] = False,
    # --- capture options ---
    source: Annotated[
        str,
        typer.Option("--source", "-s", help="Capture source: game, scene, or camera"),
    ] = "game",
    path: Annotated[
        str | None,
        typer.Option("--path", "-p", help="Output file path (capture only)"),
    ] = None,
    super_size: Annotated[
        int,
        typer.Option("--super-size", help="Resolution multiplier (1-4, game only)"),
    ] = 1,
    # --- burst options ---
    count: Annotated[
        int,
        typer.Option("--count", "-n", help="Number of frames to capture (burst only)"),
    ] = 10,
    interval_ms: Annotated[
        int,
        typer.Option("--interval", help="Minimum interval between frames in ms (burst only, 0 = fastest)"),
    ] = 0,
    output_dir: Annotated[
        str | None,
        typer.Option("--output", "-o", help="Output directory (burst only)"),
    ] = None,
    # --- common options ---
    format: Annotated[
        str,
        typer.Option("--format", "-f", help="Image format: png or jpg"),
    ] = "png",
    quality: Annotated[
        int,
        typer.Option("--quality", "-q", help="JPEG quality 1-100 (jpg only)"),
    ] = 75,
    width: Annotated[
        int | None,
        typer.Option("--width", "-W", help="Image width (camera/burst only)"),
    ] = None,
    height: Annotated[
        int | None,
        typer.Option("--height", "-H", help="Image height (camera/burst only)"),
    ] = None,
    camera_name: Annotated[
        str | None,
        typer.Option("--camera", "-c", help="Camera name"),
    ] = None,
    json_flag: Annotated[
        bool,
        typer.Option("--json", "-j", help="Output as JSON"),
    ] = False,
)

Source from the content-addressed store, hash-verified

15
16
17def screenshot(
18 ctx: typer.Context,
19 burst: Annotated[
20 bool,
21 typer.Option("--burst", help="Burst mode: capture multiple frames in rapid succession"),
22 ] = False,
23 # --- capture options ---
24 source: Annotated[
25 str,
26 typer.Option("--source", "-s", help="Capture source: game, scene, or camera"),
27 ] = "game",
28 path: Annotated[
29 str | None,
30 typer.Option("--path", "-p", help="Output file path (capture only)"),
31 ] = None,
32 super_size: Annotated[
33 int,
34 typer.Option("--super-size", help="Resolution multiplier (1-4, game only)"),
35 ] = 1,
36 # --- burst options ---
37 count: Annotated[
38 int,
39 typer.Option("--count", "-n", help="Number of frames to capture (burst only)"),
40 ] = 10,
41 interval_ms: Annotated[
42 int,
43 typer.Option("--interval", help="Minimum interval between frames in ms (burst only, 0 = fastest)"),
44 ] = 0,
45 output_dir: Annotated[
46 str | None,
47 typer.Option("--output", "-o", help="Output directory (burst only)"),
48 ] = None,
49 # --- common options ---
50 format: Annotated[
51 str,
52 typer.Option("--format", "-f", help="Image format: png or jpg"),
53 ] = "png",
54 quality: Annotated[
55 int,
56 typer.Option("--quality", "-q", help="JPEG quality 1-100 (jpg only)"),
57 ] = 75,
58 width: Annotated[
59 int | None,
60 typer.Option("--width", "-W", help="Image width (camera/burst only)"),
61 ] = None,
62 height: Annotated[
63 int | None,
64 typer.Option("--height", "-H", help="Image height (camera/burst only)"),
65 ] = None,
66 camera_name: Annotated[
67 str | None,
68 typer.Option("--camera", "-c", help="Camera name"),
69 ] = None,
70 json_flag: Annotated[
71 bool,
72 typer.Option("--json", "-j", help="Output as JSON"),
73 ] = False,
74) -> None:

Callers

nothing calls this directly

Calls 2

_burstFunction · 0.85
_captureFunction · 0.85

Tested by

no test coverage detected