sttz / install-unity

Script to install Unity 3D versions from the command line on macOS
MIT License
131 stars 25 forks source link

Unity Hub folder got renamed during install #35

Open thienhaflash opened 1 year ago

thienhaflash commented 1 year ago

I know that the rename is intentional but with that, the unity path that all my batch script will stop working during that time. Is there any way to disable this behavior? (I understand that I can use install-unity to open the project but it's not reasonable - I use unity-install to install unity and that's it).

Also, Unity got installed in a non-standard folder, is there any option to let it install in the correct (hub-based) folder with the exact minor version?

Another bug is that when we can not install Unity 2020.3 on a Mac Silicon (M1, M2), considering it's a batch script so checking if a silicon version is available is not very feasible (unity version >= 2021.2)

sttz commented 1 year ago

install-unity is using Unity's pkg packages to install the editor and build support packages. Those always install to /Applications/Unity/ and will overwrite anything already at that path. install-unity has to temporarily move anything at that path out of the way to prevent it from being overwritten.

There's an extended option to customize the install path (--opt installPathMac=…) but since the Unity Hub path is a subfolder of the pkg install path, I doubt it will work correctly when you set this option to the Hub install path. You could change the Hub install path to something that's outside /Applications/Unity/ and then set the `installPathMac´ option to the same path.

I think Unity Hub is just treating the pkg packages as archives and that's why it can install them to an arbitrary path. At the time when I was implementing this, it wasn't clear that would be safe, as the packages could contain install scripts that would be skipped when simply unarchiving the packages. I might revisit this at some point but it's not a trivial change.

install-unity defaults to trying to install the editor with the native architecture. If you want to install an Intel editor on Apple Silicon, you have to set --platform macosintel. This was made explicit to prevent accidentally installing a non-native editor.