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

Function launch_editor_with_version

unity_cli/hub/editor.py:41–71  ·  view source on GitHub ↗

Launch Unity Editor by version. Convenience function that looks up the editor path by version. Args: version: Unity version string (e.g., "2022.3.10f1"). project_path: Path to Unity project. wait: If True, wait for editor to close. Returns: Popen object

(
    version: str,
    project_path: Path,
    wait: bool = False,
)

Source from the content-addressed store, hash-verified

39
40
41def launch_editor_with_version(
42 version: str,
43 project_path: Path,
44 wait: bool = False,
45) -> subprocess.Popen[bytes] | None:
46 """Launch Unity Editor by version.
47
48 Convenience function that looks up the editor path by version.
49
50 Args:
51 version: Unity version string (e.g., "2022.3.10f1").
52 project_path: Path to Unity project.
53 wait: If True, wait for editor to close.
54
55 Returns:
56 Popen object if not waiting, None if waiting.
57
58 Raises:
59 EditorNotFoundError: If editor version not installed.
60 """
61 from unity_cli.exceptions import EditorNotFoundError
62 from unity_cli.hub.paths import find_editor_by_version
63
64 editor = find_editor_by_version(version)
65 if editor is None:
66 raise EditorNotFoundError(
67 f"Unity {version} is not installed",
68 code="EDITOR_NOT_FOUND",
69 )
70
71 return launch_editor(editor.path, project_path, wait)

Callers

nothing calls this directly

Calls 3

find_editor_by_versionFunction · 0.90
EditorNotFoundErrorClass · 0.90
launch_editorFunction · 0.85

Tested by

no test coverage detected