Skip to content

Commit 12929b4

Browse files
committed
Fix issue with missing version on error
1 parent 3af9ac3 commit 12929b4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

UnitySetup/UnitySetup.psm1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,18 @@ function Start-UnityEditor
256256

257257
if( $Instance -eq $null )
258258
{
259-
$Instance = Get-UnitySetupInstance | Select-UnitySetupInstance -Project $Project
259+
$version = Get-UnityProjectInstance -BasePath $Project | Select-Object -First 1 -ExpandProperty UnityInstanceVersion
260+
$Instance = Get-UnitySetupInstance | Select-UnitySetupInstance -Version $version
261+
}
262+
else
263+
{
264+
$version = $Instance.InstallationVersion
260265
}
261266

262267
$unityPath = $Instance.InstallationPath
263268

264269
if ( !$unityPath -or $unityPath -eq "" ) {
265-
throw "Could not find Unity editor for $($Instance.InstallationVersion)"
270+
throw "Could not find Unity Editor for version $version"
266271
}
267272

268273
$editor = Get-ChildItem "$unityPath" -Filter Unity.exe -Recurse | Select-Object -First 1 -ExpandProperty FullName

0 commit comments

Comments
 (0)