jtcmedia / chocolatey-packages

Chocolatey packages
5 stars 19 forks source link

Unity target support packages won't install #81

Open teknowledgist opened 1 month ago

teknowledgist commented 1 month ago

Describe the bug After installing the unity package, installing unity-android or unity-win-il2cpp (Those are the two I need.) fail with a GUI window "Failed to locate Unity.exe!" and then Chocolatey reports a failure with exit code 2, "Setup was cancelled".

Expected behavior Unity support packages will install if the dependency is installed.

Desktop (please complete the following information):

I did try rebooting in case the unity install had some variable or something necessary to be recognized. I also ran the installer with the /S switch manually and got the same result, so it's not directly the fault of the is package. I'm just hoping you are more knowledgeable about unity to be able to fix it. The NSIS installer does have a /D=<path> option which probably would work, but I'm not sure how to determine which Unity directory to point it at. I also don't know if the /D option would bypass the installer wanting the unity director defined.

Let me know if I can assist.

jtcmedia commented 1 month ago

The Chocolatey install package passes the /D option to the NSIS installer. Are you installing to a non-standard location? Not sure why it is failing in your case and I can't reproduce it. Like you say, it may be the Unity installer itself that is failing for some reason. A quick google search brought this up: https://discussions.unity.com/t/installer-for-the-platform-support-cant-find-unity-exe-when-i-try-to-setup/904148 although it is a bit outdated (I think the path has since changed).

teknowledgist commented 1 month ago

I hate to correct you, but the /D parameter is only used for the "unity" package if the user uses the --params InstallationPath Chocolatey option. (Of course, the user could also use --ia "/D=<path>".) The other unity packages ("unity-android" and "unity-win-il2cpp" are the ones I'm playing with.) do not have the InstallationPath package parameter code in their chocolateyinstall.ps1 script.

Note that if you follow the "official" process for offline install, you get a BAT file like:

"UnitySetup64-6000.0.19f1.exe" -UI=reduced /D=C:\Program Files\Unity 6000.0.19f1
"UnitySetup-Android-Support-for-Editor-6000.0.19f1.exe" /S /D=C:\Program Files\Unity 6000.0.19f1
"UnitySetup-Windows-IL2CPP-Support-for-Editor-6000.0.19f1.exe" /S /D=C:\Program Files\Unity 6000.0.19f1

where the destination is explicitly laid out (and I did not specify a destination in the process). Because the ancillary support packages have a version-matched dependency on the unity package, you should be able to do the same thing. (I don't know how the f1 bit works, sorry.)

The difficult part for your unity-support packages would be identifying the path when the user has chosen a custom InstallationPath location for unity. You may be able to find the custom location in the C:\ProgramData\chocolatey\.chocolatey\unity<version> folder (especially If they have set the -n=useRememberedArgumentsForUpgrades feature.) That said, you could add the installationpath parameter option to the unity-support packages and add some verbiage to the description that puts the onus on the user to make sure they pass the same installationpath for the support package as they did for the primary unity package.

Hopefully, I am making sense here. 😄

teknowledgist commented 1 month ago

I should add that I don't know why you can't reproduce it either. I'm testing it on a newly built Win11 system. It has other software on it of course, but it has no "history" with unity. (I did install unity-hub which I suppose could be affecting it. I'll try without it to see.)