unitysetup.powershell
unitysetup.powershell copied to clipboard
Start-UnityEditor fails when multiple of the same version of Unity are installed
Example with two Unity 2018.3.1f1 installed in previous install location and now hub location:
D:\repros\demo [master ≡ +12 ~1 -0 !]> Get-UnitySetupInstance
Version Components Path
------- ---------- ----
2018.1.6f1 Windows C:\Program Files\Unity\
2017.3.1f1 Windows, UWP, UWP_IL2CPP C:\Program Files\Unity-2017.3.1f1\
2017.4.8f1 Windows, StandardAssets, Vuforia C:\Program Files\Unity-2017.4.8f1\
2018.2.6f1 Windows, Linux, Mac, Documentation, Windows_IL2CPP, UWP, UWP_IL2CPP, Android, iOS, AppleTV, Facebook, Vuforia, WebGL C:\Program Files\Unity-2018.2.6f1\
2018.3.1f1 Windows, Linux, Mac, Documentation, Windows_IL2CPP, UWP, UWP_IL2CPP, Android, iOS, AppleTV, Facebook, Vuforia, WebGL C:\Program Files\Unity-2018.3.1f1\
5.5.0f3 Windows, Linux, Mac, Documentation, StandardAssets, UWP, UWP_IL2CPP, Android, iOS, AppleTV, WebGL C:\Program Files\Unity-5.5.0f3\
2018.3.1f1 Windows, Linux, Mac, Windows_IL2CPP, UWP, UWP_IL2CPP, iOS, Facebook, Vuforia, WebGL C:\Program Files\Unity\Hub\Editor\2018.3.1f1\
D:\repros\demo [master ≡ +12 ~1 -0 !]> Start-UnityEditor -Version 2018.3.1f1
Get-ChildItem : Cannot find path 'C:\Program Files\Unity-2018.3.1f1\ C:\Program Files\Unity\Hub\Editor\2' because it does not exist.
At F:\GitHub\Ziugy\unitysetup.powershell\UnitySetup\UnitySetup.psm1:1425 char:31
+ ... $editor = Get-ChildItem "$($setupInstance.Path)" -Filter 'Unity.exe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Program File...ty\Hub\Editor\2:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Start-UnityEditor : Could not find Unity.exe under setup instance path: C:\Program Files\Unity-2018.3.1f1\ C:\Program Files\Unity\Hub\Editor\2018.3.1f1\
At line:1 char:1
+ Start-UnityEditor -Version 2018.3.1f1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-UnityEditor
Start-Process : Cannot validate argument on parameter 'FilePath'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At F:\GitHub\Ziugy\unitysetup.powershell\UnitySetup\UnitySetup.psm1:1479 char:38
+ $process = Start-Process @setProcessArgs
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-Process], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.StartProcessCommand
I actually think that #153 is a duplicate of this issue.
After digging in a bit more I realized I was trying to install the version that was already on the hosted vs2017 dev ops machines. (I guess that they got updated recently, which is when I noticed it stopped working)
@Ziugy Definitely a bug as it stands, but I'm hoping for feedback on the expected action. Should it just pick the first one it finds? The one with the most components? How might we let the user invoke the right one?