@@ -94,6 +94,9 @@ class UnityVersion
94
94
if ($a.Build -lt $b.Build ) { return -1 }
95
95
if ($a.Build -gt $b.Build ) { return 1 }
96
96
97
+ if ($a.Suffix -lt $b.Suffix ) { return -1 }
98
+ if ($a.Suffix -gt $b.Suffix ) { return 1 }
99
+
97
100
return 0
98
101
}
99
102
}
@@ -392,7 +395,7 @@ function Select-UnitySetupInstance
392
395
}
393
396
}
394
397
}
395
- else { $Instances }
398
+ elseif ( $Instances .Count -gt 0 ) { $Instances }
396
399
}
397
400
end
398
401
{
@@ -494,8 +497,8 @@ function Start-UnityEditor
494
497
[CmdletBinding (DefaultParameterSetName = " Context" )]
495
498
param (
496
499
[parameter (Mandatory = $false , ValueFromPipeline = $true , ParameterSetName = ' Projects' )]
497
- [parameter (Mandatory = $true , ParameterSetName = ' ProjectsLatest' )]
498
- [parameter (Mandatory = $true , ParameterSetName = ' ProjectsVersion' )]
500
+ [parameter (Mandatory = $true , ValueFromPipeline = $true , ParameterSetName = ' ProjectsLatest' )]
501
+ [parameter (Mandatory = $true , ValueFromPipeline = $true , ParameterSetName = ' ProjectsVersion' )]
499
502
[ValidateNotNullOrEmpty ()]
500
503
[UnityProjectInstance []] $Project ,
501
504
[parameter (Mandatory = $false , ValueFromPipeline = $true , ParameterSetName = ' Setups' )]
@@ -545,7 +548,7 @@ function Start-UnityEditor
545
548
else
546
549
{
547
550
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Latest
548
- if ($null -ne $setupInstance )
551
+ if ($setupInstance .Count -gt 0 )
549
552
{
550
553
$setupInstances += , $setupInstance
551
554
}
@@ -573,7 +576,7 @@ function Start-UnityEditor
573
576
elseif ( $Latest )
574
577
{
575
578
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Latest
576
- if ($null -ne $setupInstance )
579
+ if ($setupInstance .Count -gt 0 )
577
580
{
578
581
$setupInstances = , $setupInstance
579
582
}
@@ -591,7 +594,7 @@ function Start-UnityEditor
591
594
elseif ($null -ne $Version )
592
595
{
593
596
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $Version
594
- if ($null -ne $setupInstance )
597
+ if ($setupInstance .Count -gt 0 )
595
598
{
596
599
$setupInstances = , $setupInstance
597
600
}
@@ -609,26 +612,25 @@ function Start-UnityEditor
609
612
610
613
$instanceArgs = @ ()
611
614
foreach ( $p in $projectInstances ) {
612
- $projectVersion = $p.Version
613
615
614
616
if ( $Latest ) {
615
617
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Latest
616
- if ($null -eq $setupInstance ) {
618
+ if ($setupInstance .Count -eq 0 ) {
617
619
Write-Error " Could not find any Unity Editor installed"
618
620
continue
619
621
}
620
622
}
621
623
elseif ($null -ne $Version ) {
622
624
$setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $Version
623
- if ($null -eq $setupInstance ) {
625
+ if ($setupInstance .Count -eq 0 ) {
624
626
Write-Error " Could not find Unity Editor for version $Version "
625
627
continue
626
628
}
627
629
}
628
630
else {
629
- $setupInstance = Get-UnitySetupInstance | Select-UnitySetupInstance - Version $projectVersion
630
- if ($null -eq $setupInstance ) {
631
- 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 ) "
632
634
continue
633
635
}
634
636
}
0 commit comments