Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing Editors using HUB CLI #204

Closed
StephenHodgson opened this issue May 2, 2020 · 16 comments
Closed

Installing Editors using HUB CLI #204

StephenHodgson opened this issue May 2, 2020 · 16 comments

Comments

@StephenHodgson
Copy link
Contributor

StephenHodgson commented May 2, 2020

Now that the Unity Hub has been out of beta for a while with CLI support, I wonder if it's more beneficial to just download the hub itself, and pass in any commands to it to do the downloading process for us?

This should fix any installation issues for Mac and add Linux support without a lot of additional work

Here's the hub download link:

https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.exe

Unity Hub CLI

Start-Process "C:\Program Files\Unity Hub\Unity Hub.exe" -ArgumentList "-- --headless help"

Commands

  • editors
    • description: list the releases and installed editors
    • alias: e
    • example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless editors -r
    • options:
      • [default] list of available releases and installed editors on your machine combined
      • --releases|-r only list of available releases promoted by Unity
      • --installed|-i only list of installed editors on your machine
  • install-path
    • description: set/get the path where the Unity editors will be installed
    • alias: ip
    • example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless ip -s /Applications/Unity/Hub/Editor/
    • options:
      • --set|-s <path> set the install path to the given path
      • --get|-g returns the install path
  • install
    • description: installs a new editor either from the releases list or archive
    • alias: i
    • example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 2019.1.11f1 --changeset 9b001d489a54
    • options:
      • --version|-v <version> editor version to be installed (e.g. 2019.1.11f1) - required
      • --changeset|-c <changeset> changeset of the editor if it is not in the release list (e.g. 9b001d489a54)
        • required if the version is not in the releases. see editors -r
      • --module|-m <moduleid> see install-modules for more information
  • install-modules
    • description: download and install a module (e.g. build support) to an installed editor
    • alias: im
    • example: Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-modules --version 2019.1.11f1 -m ios -m android
    • options:
      • --version|-v <version> version of the editor to add the module to (required)
      • --module|-m <moduleid> the module id. The followings are the available values depending on version. You can specify multiple values.
        • Documentation: documentation
        • Standard Assets: standardassets
        • Example Project: example
        • Android Build Support: android
        • iOS Build Support: ios
        • tvOS Build Support: appletv
        • Linux Build Support: linux
        • SamsungTV Build Support: samsung
        • Tizen Build Support: tizen
        • WebGL Build Support: webgl
        • Windows Build Support: windows
        • Facebook Gameroom Build Support: facebook-games
        • MonoDevelop / Unity Debugger: monodevelop
        • Vuforia Augmented Reality Support: vuforia-ar
        • Language packs: language-ja, language-ko, language-zh-cn, language-zh-hant, language-zh-hans
        • Mac Build Support (IL2CPP): mac-il2cpp
        • Windows Build Support (Mono): windows-mono
        • Android SDK & NDK Tools: android-sdk-ndk-tools
        • Lumin OS (Magic Leap) Build Suppor: lumin
@jwittner
Copy link
Member

jwittner commented May 6, 2020

The need for --changeset 9b001d489a54 is very annoying lol, otherwise I think this would be great! Out of curiosity, what's the oldest version of Unity we could install with this?

I'd have to test some examples of what comes down in the 'releases' list. If it's really limited, I'd wonder if we'd still need to do all our web crawling anyways to find the changesets.

@StephenHodgson
Copy link
Contributor Author

I think you can easily get the change set from the download archive

@jwittner
Copy link
Member

jwittner commented May 7, 2020

You mean manually? Or you think it'd be easy automatically with less effort than what we're currently doing? A big value here is that you can get a unity project version, find the installers, then install without any human intervention.

@StephenHodgson
Copy link
Contributor Author

no, using a crawler of some kinda like you suggested above. But adding a change set parameter in the powershell installer probably wouldn't be a bad idea either if someone has a specific one in mind.

@bddckr
Copy link

bddckr commented May 7, 2020

Going by the above command list it seems this does not support any license management?

@StephenHodgson
Copy link
Contributor Author

Doesn't matter, you can still pass license to the editor application like usual

@bddckr
Copy link

bddckr commented May 7, 2020

That has been done using this PowerShell module so far. Are you saying this doesn't actually replace that part then?

@StephenHodgson
Copy link
Contributor Author

Not at the moment, no. But I think it's on their roadmap.

@StephenHodgson
Copy link
Contributor Author

StephenHodgson commented May 7, 2020

@jwittner I think it's important to note that if you know where the Unity Project is located you can easily get the revision number in the ProjectVersion.txt:

m_EditorVersion: 2019.3.11f1
m_EditorVersionWithRevision: 2019.3.11f1 (ceef2d848e70)

Regex:

(?<version>(?:(?<major>\d+)\.)?(?:(?<minor>\d+)\.)?(?:(?<patch>\d+[fab]\d+)\b))|((?:\((?<revision>\w+))\))

image

@jwittner
Copy link
Member

jwittner commented May 7, 2020

@StephenHodgson - that's cool! Unfortunately it's only available for Unity 2019 versions. =(

@StephenHodgson
Copy link
Contributor Author

Fallback is the crawler ;)

Or just compile a list of all the revisions to their versions haha. Have a fast lookup table or something lmao.

@StephenHodgson
Copy link
Contributor Author

StephenHodgson commented Jun 9, 2020

Here's a powershell script I've been working on and using in my CI/CD workflow.
https://github.com/StephenHodgson/UnityCI/blob/master/InstallUnityHub.ps1

Sadly the Linux stuff doesn't work for whatever reason (bc Unity)
https://forum.unity.com/threads/unity-hub-linux-commands-do-not-execute-the-same-as-windows-macos.907538/

But maybe we can support both workflows?

In either case I also asked that it get added to the hosted agent image as well.
actions/runner-images#1013

@bdovaz
Copy link

bdovaz commented Sep 16, 2020

Any news on this? I personally tested the Hub cli but my feelings are that it's still really unstable and I don't see really bug fixing on recent releases:

https://unity3d.com/es/hub/whats-new

@jwittner
Copy link
Member

No current plans to do this refactor.

@StephenHodgson
Copy link
Contributor Author

Hub cli is now installed on windows images by default but have not checked mac or linux vms.

I've moved on from this for a while as it's much easier to install the required versions I need via hub and a few short ps scripts.

@jwittner
Copy link
Member

Closing as original creator no longer needs it, if this is very desirable for others let me know and we can reopen.

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

No branches or pull requests

4 participants