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,
)
| 7 | |
| 8 | |
| 9 | def 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 | |
| 41 | def launch_editor_with_version( |
no test coverage detected