--- name: uloop-launch description: "Launch or restart Unity Editor. Use only when Unity is not running, stays frozen after retries, or a compile result recommends a restart — not as a health check after a failed command; it brings the Unity window to the foreground as a side effect." --- # uloop launch Launch Unity Editor with the correct version for a project. `uloop launch` is not fire-and-forget. When Unity needs to start or restart, the command waits until Unity is actually ready for CLI operations before it exits. ## Usage ```bash uloop launch [project-path] [options] ``` ## Parameters | Parameter | Type | Description | |-----------|------|-------------| | `project-path` | string | Optional. Use only when the target Unity project is not in the current directory. | | `-r, --restart` | flag | Quit running Unity and restart | | `-q, --quit` | flag | Quit an existing Unity process for the project without launching | | `--editor-version ` | string | Use this Unity Editor version instead of ProjectVersion.txt | | `-p, --platform

` | string | Build target (e.g., StandaloneOSX, Android, iOS) | | `--log-file ` | string | Write this Editor's log to `` instead of the log every Editor shares. A relative path starts from the current directory | | `--max-depth ` | number | Search depth when project-path is omitted (default: 3, -1 for unlimited) | ## Output May print status/progress lines before the final JSON payload, such as project path, detected Unity version, or readiness wait messages. The final JSON payload includes: - `Success`: whether the command completed - `Ready`: whether Unity CLI Loop is ready for commands - `ServerReady`: whether the Unity CLI Loop server accepted requests - `ProjectIpcReady`: whether the project IPC path accepted tool requests - `AlreadyRunning`: whether an existing Unity process was reused - `Launched`: whether this command launched a Unity process - `Restarted`: whether this command stopped an existing process and launched a new one - `Quit`: whether this command stopped Unity without launching a new process - `PreviousProcessId`: process ID stopped by restart or quit, when available - `StopMethod`: how restart or quit stopped that process, omitted when there was none — `Quit` when Unity exited on request, `ForceKill` when it had to be killed - `CurrentProcessId`: current Unity process ID, when available - `SafeModePromptIgnored`: `true` when launch pressed Ignore on Unity's "Enter Safe Mode?" prompt; omitted otherwise - `OlderPackageProtocol`: `true` when the dispatcher speaks a newer IPC protocol than the project's package, so launch confirmed only that the Editor answers; omitted otherwise - `ProjectRoot`: resolved project root - `Message`: readiness summary ## When not to use A single failed, cancelled, or busy command (e.g. right after a domain reload) is not a reason to launch — retry the command instead. Running launch while the Editor is up brings the Unity window to the foreground, which disrupts the user. Reach for launch only when Unity is not running, still does not respond after retries, or a `uloop compile` result's `Warning` recommends `uloop launch -r` because domain reloads have slowed down. That restart discards unsaved scene changes, so ask the user before running it. ## Notes - If Unity is already running, focuses the existing window and verifies tool readiness - `--restart` and `--quit` ask Unity to quit first: it saves its window layout and discards unsaved scene changes without a save dialog. Unity is force-killed instead, losing the layout, when it cannot take the request (frozen, or a package that predates it) or does not exit within 30 seconds - If process scan is blocked (e.g. sandboxed `ps`), plain launch falls back to IPC probing; `--restart`, `--quit`, and `--log-file` still fail because they need the process scan - Every Editor this command starts carries `-launchedByUloop` in its command line, which tells it apart in a process list from one started by Unity Hub or by hand. Unity ignores the argument, and drops it together with `--log-file` when it relaunches itself (a setting that asks for an Editor restart), so a missing mark does not prove the Editor never came from this command. An Editor started by an older dispatcher carries `-ignorecompilererrors` instead - `--editor-version` only affects new Unity processes; use it with `--restart` to replace an already-running Editor - Without `--log-file`, every Editor on the machine uses the same log: each start renames it to `Editor-prev.log` and deletes the older one. Starting one Editor moves another running Editor's log away from `Editor.log`, and the next start deletes it. When several Editors run at once, pass `--log-file` on every launch - `--log-file` only affects new Unity processes; use it with `--restart` to replace an already-running Editor. A start overwrites that file and keeps no previous copy, so read it first after a crash. The step other commands print after an abnormal exit, which names this Editor's log, only looks at the shared log: it does not know this path, and can name an older log of the same project - The command waits until Unity finishes startup and the CLI can connect before returning - If a modal dialog holds Unity while launch waits (such as a package prompt while a project opens), launch stops within a few seconds with `BLOCKED_BY_DIALOG` instead of waiting out its timeout; the Editor keeps running. Read `Details.Dialogs`, answer it as `NextActions` say, then run `uloop launch` again. macOS and Windows only - When Unity offers Safe Mode because the project has compile errors, launch presses Ignore on that prompt itself (macOS and Windows), keeps waiting, and returns `SafeModePromptIgnored: true`; if launch still stops with `BLOCKED_BY_DIALOG` or `UNITY_STARTUP_TIMEOUT`, the error's `Details` carries it instead. The compile errors remain: run `uloop compile` to list them. Any other dialog still stops launch as above