@@ -395,7 +395,7 @@ function Select-UnitySetupInstance
395
395
}
396
396
}
397
397
}
398
- else { $Instances }
398
+ elseif ( $Instances .Count -gt 0 ) { $Instances }
399
399
}
400
400
end
401
401
{
@@ -548,7 +548,7 @@ function Start-UnityEditor
548
548
else
549
549
{
550
550
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Latest
551
- if ($null -ne $setupInstance )
551
+ if ($setupInstance .Count -gt 0 )
552
552
{
553
553
$setupInstances += , $setupInstance
554
554
}
@@ -576,7 +576,7 @@ function Start-UnityEditor
576
576
elseif ( $Latest )
577
577
{
578
578
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Latest
579
- if ($null -ne $setupInstance )
579
+ if ($setupInstance .Count -gt 0 )
580
580
{
581
581
$setupInstances = , $setupInstance
582
582
}
@@ -594,7 +594,7 @@ function Start-UnityEditor
594
594
elseif ($null -ne $Version )
595
595
{
596
596
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $Version
597
- if ($null -ne $setupInstance )
597
+ if ($setupInstance .Count -gt 0 )
598
598
{
599
599
$setupInstances = , $setupInstance
600
600
}
@@ -612,26 +612,25 @@ function Start-UnityEditor
612
612
613
613
$instanceArgs = @ ()
614
614
foreach ( $p in $projectInstances ) {
615
- $projectVersion = $p.Version
616
615
617
616
if ( $Latest ) {
618
617
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Latest
619
- if ($null -eq $setupInstance ) {
618
+ if ($setupInstance .Count -eq 0 ) {
620
619
Write-Error " Could not find any Unity Editor installed"
621
620
continue
622
621
}
623
622
}
624
623
elseif ($null -ne $Version ) {
625
624
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $Version
626
- if ($null -eq $setupInstance ) {
625
+ if ($setupInstance .Count -eq 0 ) {
627
626
Write-Error " Could not find Unity Editor for version $Version "
628
627
continue
629
628
}
630
629
}
631
630
else {
632
- $setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $projectVersion
633
- if ($null -eq $setupInstance ) {
634
- Write-Error " Could not find Unity Editor for version $projectVersion "
631
+ $setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $p .Version
632
+ if ($setupInstance .Count -eq 0 ) {
633
+ Write-Error " Could not find Unity Editor for version $ ( $p .Version ) "
635
634
continue
636
635
}
637
636
}
0 commit comments