Installing Unity through Unity Hub CLI missing options when installing modules

Introduction

I’m trying to automate installing Unity on our own build server (we can’t use Unity cloud build). The idea is as follows:

  1. User kicks of a build
  2. Build script starts on build server
  3. Unity build server opens projectverison.txt
  4. PowerShell script starts and uses Unity Hub CLI to check if this specific version of Unity is already installed
  5. If not it installs it using Unity Hub CLI
  6. Unity build continues…

However this fails on step 5 as the modules you can install through the UI don’t match the modules you can install through the CLI.

Installing Unity 2019.2.12f1

For example, if we look at 2019.2.12f1 we can see that they list in the UI doesn’t match the CLI list:


(I couldn’t find a match for the Red Lines)

Also, if I then install it using this command:

'unity hub.exe' -- --headless install --version "2019.2.12f1" -m standardassets -m android -m windows -m windows-mono -m android-sdk-ndk-tools

I see the following output:

Missing module standardassets. Skipping..
Missing module windows. Skipping..
Missing module windows-mono. Skipping..
0.00% of Unity editor "2019.2.12f1" was downloaded
1.22% of Unity editor "2019.2.12f1" was downloaded
2.79% of Unity editor "2019.2.12f1" was downloaded

So even the modules that should be available, can’t be found by the installer.

After the installation there’s only 1 module installed:

So it seems that even the modules that do have an exact match in the Unity Hub CLI don’t get installed.

Installing Unity 2018.4.12f1

When we look at older versions of Unity the list gets even more confusing:

'unity hub.exe' -- --headless install --version "2018.4.12f1" -m standardassets -m android -m windows -m windows-mono -m android-sdk-ndk-tools

Output:

Missing module standardassets. Skipping..
Missing module windows. Skipping..
Missing module windows-mono. Skipping..

0.01% of Unity editor "2018.4.12f1" was downloaded
2.00% of Unity editor "2018.4.12f1" was downloaded

Installing Unity 2017.4.34f1

'unity hub.exe' -- --headless install --version "2017.4.34f1" -m standardassets -m android -m windows -m windows-mono -m android-sdk-nds-tools

Output:

Missing module windows. Skipping..
Missing module windows-mono. Skipping..

0.01% of Unity editor "2017.4.34f1" was downloaded
1.59% of Unity editor "2017.4.34f1" was downloaded
4.15% of Unity editor "2017.4.34f1" was downloaded

Directly calling install-modules

I also tested directly calling install modules using this command which includes all options available according to the CLI help:

'unity hub.exe' -- --headless install-modules --version "2019.2.12f1" -m standardassets -m example -m android -m ios -m appletv -m linux -m samsung -m tizen -m webgl -m windows -m facebook-games -m monodevelop -m vuforia-ar -m mac-il2cpp -m windows-mono -m android-sdk-ndk-tools -m lumin

Output:

Missing module standardassets. Skipping..
Missing module example. Skipping..
Missing module samsung. Skipping..
Missing module tizen. Skipping..
Missing module windows. Skipping..
Missing module monodevelop. Skipping..
Missing module vuforia-ar. Skipping..
Missing module mac-il2cpp. Skipping..
Missing module windows-mono. Skipping..
Adding module facebookgameroom as dependency of facebook-games.
Adding module android as dependency of android-sdk-ndk-tools.
Adding module android-sdk-platform-tools as dependency of android-sdk-ndk-tools.
Adding module android-sdk-build-tools as dependency of android-sdk-ndk-tools.
Adding module android-sdk-platforms as dependency of android-sdk-ndk-tools.
Adding module android-ndk as dependency of android-sdk-ndk-tools.
Omitting module android because it's already installed

So even the modules that (atleast to me) seem to match the CLI documentation, apparently don’t. As they also report as missing once I install it using the CLI.

Question

So basically my problem/question is, how do I install these versions of Unity with the correct modules?

1 Like

Where you have your Unity installed, there is a modules.json file, the “id” of the elements in that file are what you should use with the command line.
For example there is “windows-il2cpp” for Windows Build Support (IL2CPP). Not sure if it’s the same name for all Unity versions though.

The mismatch in the help is maybe for future versions ?

1 Like

Using your advise I quickly created a tool to extract what modules are available per installed version. This is the output for me:

Unity Installations:

==== Unity 2017.4.32f1 ===
>>>  -m android
      -m appletv
      -m documentation
      -m example
      -m facebookgameroom
      -m facebook-games
      -m ios
      -m linux
      -m mac
>>>  -m metro
      -m monodevelop
      -m standardassets
>>>  -m uwp-il2cpp
      -m visualstudio
>>>  -m visualstudioenterpriseunityworkload
      -m visualstudioprofessionalunityworkload
>>>  -m vuforia-ar
      -m webgl

==== Unity 2018.2.21f1 ===
>>>  -m android
      -m appletv
      -m documentation
      -m facebookgameroom
      -m facebook-games
      -m ios
      -m language-ja
      -m language-ko
      -m language-zh-cn
      -m linux
      -m mac-mono
>>>  -m uwp-.net
>>>  -m uwp-il2cpp
      -m visualstudio
>>>  -m visualstudioenterpriseunityworkload
      -m visualstudioprofessionalunityworkload
      -m vuforia-ar
      -m webgl
>>>  -m windows-il2cpp

==== Unity 2018.4.9f1 ===
>>>  -m android
      -m appletv
      -m documentation
      -m facebookgameroom
      -m facebook-games
      -m ios
      -m language-ja
      -m language-ko
      -m language-zh-cn
      -m linux
      -m mac-mono
>>>  -m uwp-.net
>>>  -m uwp-il2cpp
      -m visualstudio
>>>  -m visualstudioenterpriseunityworkload
      -m visualstudioprofessionalunityworkload
>>>  -m vuforia-ar
      -m webgl
      -m windows-il2cpp

==== Unity 2019.1.14f1 ===
>>>  -m android
>>>  -m android-ndk
>>>  -m android-sdk-build-tools
>>>  -m android-sdk-ndk-tools
>>>  -m android-sdk-platforms
>>>  -m android-sdk-platform-tools
      -m appletv
      -m documentation
      -m facebookgameroom
      -m facebook-games
      -m ios
      -m language-ja
      -m language-ko
      -m language-zh-hans
      -m language-zh-hant
>>>  -m linux
      -m lumin
      -m mac-mono
>>>  -m universal-windows-platform
      -m visualstudio
>>>  -m visualstudioenterpriseunityworkload
      -m visualstudioprofessionalunityworkload
>>>  -m vuforia-ar
      -m webgl
>>>  -m windows-il2cpp

Hopefully this is usefull to someone

5 Likes

Would you mind to share this script, please?

@devedse Have you tried installing the “linux” module with the Hub CLI? The help says it’s supposed to be called linux, but I had to actually use linux-mono.

Great hint, thanks!

1 Like