Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Resolved Unity Hub headless not exiting on Windows

Discussion in 'Unity Hub' started by hadrien23, Dec 13, 2021.

  1. hadrien23

    hadrien23

    Joined:
    Oct 9, 2019
    Posts:
    12
    I'm trying to integrate Unity Hub to a build pipeline, and I can't figure out how to exit Unity Hub in headless mode on Windows: the process always waits for a user input to exit.

    My end goal is to figure out if the editor for the current project version is installed, or install it if it's not.

    I'm using Unit Hub 2.4.5, and run this command to retrieve the list of installed editors:
    "C:/Program Files/Unity Hub/Unity Hub.exe" -- --headless editors -i

    The issue is Windows only, on Mac the process will exit right after printing the list of editors.
    Is there other any way to do the same on Windows?
     
  2. hadrien23

    hadrien23

    Joined:
    Oct 9, 2019
    Posts:
    12
    OK For anyone having the same issue, user input is skippable on Windows by starting Unity Hub from cmd.exe, with the /c argument.

    From the command line:
    cmd /c "C:/Program Files/Unity Hub/Unity Hub.exe" -- --headless editors -i

    From a dotnet project that would look like this:
    Process.Start("cmd.exe", "/c \"C:/Program Files/Unity Hub/Unity Hub.exe\" -- --headless editors -i");

    Still, I don't know why Unity Hub exe would wait for an input in headless mode... would appreciate if the Unity team can fix that in a future version of the hub!