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

Function scene_load

unity_cli/cli/commands/scene.py:76–99  ·  view source on GitHub ↗

Open a scene in the editor (single or additive). Identify the scene by asset path (--path) or by scene name (--name). Paths resolve relative to the project (Assets/...). Unsaved changes in the current scene are discarded unless --additive is set. Examples: u scene load -p A

(
    ctx: typer.Context,
    path: Annotated[str | None, typer.Option("--path", "-p", help="Scene path")] = None,
    name: Annotated[str | None, typer.Option("--name", "-n", help="Scene name")] = None,
    additive: Annotated[bool, typer.Option("--additive", "-a", help="Load additively")] = False,
)

Source from the content-addressed store, hash-verified

74@scene_app.command("load")
75@handle_cli_errors
76def scene_load(
77 ctx: typer.Context,
78 path: Annotated[str | None, typer.Option("--path", "-p", help="Scene path")] = None,
79 name: Annotated[str | None, typer.Option("--name", "-n", help="Scene name")] = None,
80 additive: Annotated[bool, typer.Option("--additive", "-a", help="Load additively")] = False,
81) -> None:
82 """Open a scene in the editor (single or additive).
83
84 Identify the scene by asset path (--path) or by scene name (--name).
85 Paths resolve relative to the project (Assets/...). Unsaved changes in the
86 current scene are discarded unless --additive is set.
87
88 Examples:
89 u scene load -p Assets/Scenes/Main.unity
90 u scene load -n Main
91 u scene load -p Assets/Scenes/UI.unity --additive
92 """
93 context: CLIContext = ctx.obj
94
95 if not path and not name:
96 _exit_usage("--path or --name required", "u scene load")
97
98 result = context.client.scene.load(path=path, name=name, additive=additive)
99 print_success(result.get("message", "Scene loaded"))
100
101
102@scene_app.command("save")

Callers

nothing calls this directly

Calls 4

_exit_usageFunction · 0.90
print_successFunction · 0.90
loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected