Search Unity

Unity Hub CLI documentation

Discussion in 'Unity Hub' started by MikuriChan, Aug 29, 2019.

Thread Status:
Not open for further replies.
  1. MikuriChan

    MikuriChan

    Joined:
    Sep 3, 2018
    Posts:
    5
    Hello,

    I can't find the documentation about the Unity Hub CLI. I'd like to learn about how to install the editor with android support and to activate the licence.

    Google isn't of help for this, nor does the Unity Hub page and installation guide hasn't the slightiest info about it.

    Thank you very much.
     
  2. marwi

    marwi

    Joined:
    Aug 13, 2014
    Posts:
    138
  3. mmvlad

    mmvlad

    Joined:
    Dec 31, 2014
    Posts:
    98
    @marwi
    Can you please elaborate on how you used CLI? I am on MacOS and can't even find a trace of it.
     
  4. marwi

    marwi

    Joined:
    Aug 13, 2014
    Posts:
    138
    yeah there is not a whole lot of documentation

    you can print the help using

    -- --headless help

    "path/to/hub/exe -- --headless help" (I forgot how to call cli commands on mac, probably the same :))
     
    ReneSchleese and AndreiMarian like this.
  5. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    77
    Anyone knows if Unity Hub CLI can be used to create a new project? (With command line arguments like "advanced project settings" allows)

    I know of launching Unity from CLI:
    "C:\Program Files\Unity\Editor\Unity.exe" -createProject <to path>

    but there's no way to specify a template (namely URP :rolleyes:)
     
    Last edited: Aug 27, 2020
  6. AndreiMarian

    AndreiMarian

    Joined:
    Jun 9, 2015
    Posts:
    77
    I thought it wouldn't hurt to paste the help in here:

    Code (CSharp):
    1. Commands:
    2.         editors
    3.                 description: list the releases and installed editors
    4.                 alias: e
    5.                 example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless editors -r
    6.                 options:
    7.                         [default]               list of available releases and installed editors on your machine combined
    8.                         --releases|-r   only list of available releases promoted by Unity
    9.                         --installed|-i  only list of installed editors on your machine
    10.  
    11.         install-path
    12.                 description: set/get the path where the Unity editors will be installed
    13.                 alias: ip
    14.                 example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless ip -s /Applications/Unity/Hub/Editor/
    15.                 options:
    16.                         --set|-s <path>         set the install path to the given path
    17.                         --get|-g                        returns the install path
    18.  
    19.         install
    20.                 description: installs a new editor either from the releases list or archive
    21.                 alias: i
    22.                 example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 2019.1.11f1 --changeset 9b001d489a54
    23.                 options:
    24.                         --version|-v <version>          editor version to be installed (e.g. 2019.1.11f1) - required
    25.                         --changeset|-c  <changeset> changeset of the editor if it is not in the release list (e.g. 9b001d489a54)
    26.                                                                                 - required if the version is not in the releases. see editors -r
    27.                         --module|-m <moduleid>          see install-modules for more information
    28.  
    29.         install-modules
    30.                 description: download and install a module (e.g. build support) to an installed editor
    31.                 alias: im
    32.                         example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-modules --version 2019.1.11f1 -m ios -m android
    33.                 options:
    34.                         --version|-v <version>  version of the editor to add the module to - required
    35.                         --module|-m  <moduleid> the module id. The followings are the available values depending on version. You can specify multiple values.
    36.                                                                         Documentation: documentation
    37.                                                                         Standard Assets: standardassets
    38.                                                                         Example Project: example
    39.                                                                         Android Build Support: android
    40.                                                                         iOS Build Support: ios
    41.                                                                         tvOS Build Support: appletv
    42.                                                                         Linux Build Support: linux
    43.                                                                         SamsungTV Build Support: samsung
    44.                                                                         Tizen Build Support: tizen
    45.                                                                         WebGL Build Support: webgl
    46.                                                                         Windows Build Support: windows
    47.                                                                         Facebook Gameroom Build Support: facebook-games
    48.                                                                         MonoDevelop / Unity Debugger: monodevelop
    49.                                                                         Vuforia Augmented Reality Support: vuforia-ar
    50.                                                                         Language packs: language-ja, language-ko, language-zh-cn, language-zh-hant, language-zh-hans
    51.                                                                         Mac Build Support (IL2CPP): mac-il2cpp
    52.                                                                         Windows Build Support (Mono): windows-mono
    53.                                                                         Android SDK & NDK Tools: android-sdk-ndk-tools
    54.                                                                         Lumin OS (Magic Leap) Build Suppor: lumin
     
  7. FIFTYTWO

    FIFTYTWO

    Joined:
    Oct 21, 2014
    Posts:
    49
    Unity Hub on macOS doesn't display any CLI switches except for --help. I executed the following command:
    Code (CSharp):
    1. /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub --headless --help
    Which produced the following output:
    Code (CSharp):
    1. Options:
    2.   -h, --help  Show help                                                [boolean]
    3.  
    As I remember on Windows there was some switch (don't remember exactly its name) to request installed Unity paths. Is it possible to request the paths on macOS?
     
    ModLunar likes this.
  8. marwi

    marwi

    Joined:
    Aug 13, 2014
    Posts:
    138
    Are you sure the command is correct? Looking at my response earlier I think it should be ``-- --headless help``
     
    ryanslikesocool and FIFTYTWO like this.
  9. FIFTYTWO

    FIFTYTWO

    Joined:
    Oct 21, 2014
    Posts:
    49
    Yes, you're right, I forgot --, thank you a lot, now it works!
     
    marwi likes this.
  10. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    What does the -- mean? Why not just --headless?
     
  11. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    228
    Bump. Would really like to be able to use the Hub via CLI, as well.

    My goal: Ability to open a Unity project, in the proper editor version, without the CLI command needing to contain anything other than the path to the Unity Hub (constant) + path-to-project. From there, the Hub can open the project with the proper editor version based on the meta-data that it has. And of course, it can just throw an error or pop a dialog if the editor version required isn't available, etc. -- same as it does now, just from the CLI.

    Basically, I have two constants: UNITY_HUB_PATH and PROJECT_DIR. The unknown is editor version & editor path (we generally are pretty-constantly upgrading through each minor release), and we don't want to have to re-invent the wheel & track the editor version ourselves / externally.

    FWIW, the purpose of this is so that we can create an alias / shortcut / bash script to open up a Unity project and, specifically on macOS, because I want to be able to set a custom "icon" for the bash script/alias -- goal being that, when I have 5 Unity projects open (each in their own Unity instance), I can have the macOS 'Dock' icon be displaying a project-specific icon for fast visual ID / workflow reasons.
     
  12. UnityJuju

    UnityJuju

    Unity Technologies

    Joined:
    Jun 15, 2021
    Posts:
    222
    Hey there!
    Please, don't bump/necro old threads :cool:

    Thank you for sharing your request with us! I'll raise it with the Hub team.

    I'll close this thread for now.
     
    white_pyjamas likes this.
Thread Status:
Not open for further replies.