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

Function launch_editor

unity_cli/hub/editor.py:9–38  ·  view source on GitHub ↗

Launch Unity Editor with project. Args: editor_path: Path to Unity executable. project_path: Path to Unity project. wait: If True, wait for editor to close. Returns: Popen object if not waiting, None if waiting.

(
    editor_path: Path,
    project_path: Path,
    wait: bool = False,
)

Source from the content-addressed store, hash-verified

7
8
9def launch_editor(
10 editor_path: Path,
11 project_path: Path,
12 wait: bool = False,
13) -> subprocess.Popen[bytes] | None:
14 """Launch Unity Editor with project.
15
16 Args:
17 editor_path: Path to Unity executable.
18 project_path: Path to Unity project.
19 wait: If True, wait for editor to close.
20
21 Returns:
22 Popen object if not waiting, None if waiting.
23 """
24 cmd = [
25 str(editor_path),
26 "-projectPath",
27 str(project_path.resolve()),
28 ]
29
30 if wait:
31 subprocess.run(cmd, check=False)
32 return None
33 else:
34 return subprocess.Popen(
35 cmd,
36 stdout=subprocess.DEVNULL,
37 stderr=subprocess.DEVNULL,
38 )
39
40
41def launch_editor_with_version(

Callers 2

open_projectMethod · 0.90

Calls 1

runMethod · 0.45

Tested by

no test coverage detected