Skip to content

Open projects signed in, without the official Hub (Unity CLI) - #66

Closed
ManeFunction wants to merge 16 commits into
Ravbug:masterfrom
ManeFunction:feature/login-with-cli
Closed

ManeFunction wants to merge 16 commits into
Ravbug:masterfrom
ManeFunction:feature/login-with-cli

Conversation

@ManeFunction

Copy link
Copy Markdown
Contributor

A few years ago, the main problem with UnityHubNative was that it launched the official Unity Hub, which defeated the whole point of using a native alternative. That’s why I stopped using it back then. This problem was described in the issue #28.

Now that I’ve returned to the project, I’ve tested its current behavior on macOS and Linux with the latest Unity Hub and the entire Unity 6 lineup (from 6.0 to 6.6), and it looks like the problem has changed. Unity Hub no longer launches automatically, but the Unity Editor cannot handle authentication unless the official Hub is running. As a result, any Editor launched without the official Hub starts with the user logged out, leaving the Asset Store and Unity Services unavailable.

After doing some research, I found that we can launch the Editor using the new Unity CLI, designed for AI agents. I’ve integrated this CLI-based launch method into UnityHubNative, with a fallback to the previous one. I’ve also added a helper to guide users through installing the new Unity CLI using the official installer if they don’t have it already installed.

Additional fixes

  • wxWidgets patch (patches/wxWidgets/wakeuppipe-lost-wakeup.patch, documented in patches/wxWidgets/README.md). A race in wxWakeUpPipe::WakeUpNoLock() could permanently skip wake-ups. wxWidgets then stopped noticing that child processes had exited, so CLI commands seemed to hang forever. The flag is now atomic and is claimed before the write.

Testing

OS Result
macOS 13 Tested
Fedora 45 Tested
Windows Not tested (do not have a Windows machine)
  • Tested with Unity 6 from 6.0 to 6.6.
  • Checked: a project opens signed in with no Hub running, the direct-launch fallback works, and the install and login helper works.
  • Not tested: Editors older than Unity 6. The CLI docs name no minimum Editor version, and the README says 2019.1 and newer. 2018 and older sign in on their own.

Notes

  • As of writing, the CLI has no stable release. latest.json returns 404, and only latest-beta.json exists. That is why the installer falls back to the beta channel.

wxWakeUpPipe::WakeUpNoLock() wrote to the pipe and only then cleared
m_pipeIsEmpty. When the main thread drained the pipe in between, the flag
stayed false forever, so no later SIGCHLD was written to the pipe. Child
processes were never reaped and wxExecute() waited for them indefinitely,
which left opening a project through the Unity CLI stuck.

Make the flag atomic and claim it before writing.
…ress pulse

wxProgressDialog::Pulse() yields to the event loop, which on GTK may handle the
command's SIGCHLD, so OnTerminate could destroy the progress window and the
CommandProcess while Pulse() and OnPulse() were still using them. Close the
window and delete the process from CallAfter instead.
Marks the patched code and keeps the patch under patches/wxWidgets, so a
future wxWidgets update doesn't silently drop it.
globals.h looked the home folder up three times and the Unity CLI code a fourth
time, none checking that getpwuid() succeeded. Look it up once, falling back to
$HOME.
The JSON helpers took the first matching key anywhere in the document, so a
nested "path" in cli-install.json could shadow the real one. Look values up
by the path of member names instead, e.g. data.loggedIn for auth status.
The script was spliced together from many string literals around the manifest
URL. Pass the URL as an argument instead.
… refresh

Locate(), Find() and recentEnough described three states (missing, too old,
ready) that every caller rebuilt by hand, and each lookup ran `unity --version`
again: twice at startup and once per project open. Probe() now returns a
UnityCliStatus that holds the CLI only when it is ready, and the main window
keeps the last one, refreshed on startup, Reload and after installing or
signing in.
…launch into one function

OpenProjectInEditor() decides whether to open a project through the CLI, and
falls back to launch_editor(), which now owns the Editor's command line. The
main window no longer builds the command line or passes a fallback callback,
and UnityCli no longer exposes CanOpen() and Open().
Creating a project launched the Editor directly, so it started signed out and
started the official Hub. With a ready CLI, the Editor now creates the project
in batch mode, which needs no sign-in, behind a progress window that can
cancel it, and the project then opens through the CLI. If creating fails, it
offers to create the project directly instead.

The create dialog now hands back the editor and template instead of a command
line, which launch_editor_create() builds.
UnityCliController owns the Install CLI and Login CLI buttons, the install
prompt and the install-then-sign-in flow, and keeps the last CLI status. The
main window only creates it and forwards its button events.
@Ravbug

Ravbug commented Nov 6, 2026

Copy link
Copy Markdown
Owner

As I mentioned in this other PR (#63 (comment)), this project does not allow AI-generated code dumps. In addition, I don't want to fork wxWidgets but it appears that you have made source modifications to it.

As such, I cannot accept this PR. Sorry.

@Ravbug Ravbug closed this Nov 6, 2026
@ManeFunction

Copy link
Copy Markdown
Contributor Author

It's OK, I understand this decision. In that case I'll switch to my own fork, using Unity that is not logged-in has some level of discomfort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants