@@ -290,15 +290,38 @@ function Get-UnityEditor {
290
290
Help to create UnitySetupComponent
291
291
. PARAMETER Components
292
292
What components would you like included?
293
+ . PARAMETER Version
294
+ Allows for conversion that can take into account version restrictions
295
+ E.g. 2019.x only supports UWP_IL2CPP
293
296
. EXAMPLE
294
297
ConvertTo-UnitySetupComponent Windows,UWP
298
+ . EXAMPLE
299
+ ConvertTo-UnitySetupComponent Windows,UWP -Version 2019.3.4f1
295
300
#>
296
301
function ConvertTo-UnitySetupComponent {
297
302
[CmdletBinding ()]
298
303
param (
299
304
[parameter (Mandatory = $true , Position = 0 )]
300
- [UnitySetupComponent ] $Component
305
+ [UnitySetupComponent ] $Component ,
306
+ [parameter (Mandatory = $false )]
307
+ [UnityVersion ] $Version
301
308
)
309
+
310
+ if ($Version ) {
311
+ if ($Version.Major -ge 2019 ) {
312
+ if ($Component -band [UnitySetupComponent ]::UWP) {
313
+ if ( $Component -band [UnitySetupComponent ]::UWP_IL2CPP) {
314
+ Write-Verbose " 2019.x only supports IL2CPP for UWP - removing $ ( [UnitySetupComponent ]::UWP) "
315
+ }
316
+ else {
317
+ Write-Verbose " 2019.x only supports IL2CPP for UWP - swapping to $ ( [UnitySetupComponent ]::UWP_IL2CPP) "
318
+ $Component += [UnitySetupComponent ]::UWP_IL2CPP;
319
+ }
320
+
321
+ $Component -= [UnitySetupComponent ]::UWP;
322
+ }
323
+ }
324
+ }
302
325
303
326
$Component
304
327
}
@@ -327,6 +350,8 @@ function Find-UnitySetupInstaller {
327
350
[UnitySetupComponent ] $Components = [UnitySetupComponent ]::All
328
351
)
329
352
353
+ $Components = ConvertTo-UnitySetupComponent - Component $Components - Version $Version
354
+
330
355
$currentOS = Get-OperatingSystem
331
356
switch ($currentOS ) {
332
357
([OperatingSystem ]::Windows) {
@@ -370,6 +395,12 @@ function Find-UnitySetupInstaller {
370
395
[UnitySetupComponent ]::Lumin = , " $targetSupport /UnitySetup-Lumin-Support-for-Editor-$Version .$installerExtension " ;
371
396
}
372
397
398
+ # In 2019.x there is only IL2CPP UWP so change the search for UWP_IL2CPP
399
+ if ( $Version.Major -ge 2019 ) {
400
+ $installerTemplates [[UnitySetupComponent ]::UWP _IL2CPP ] = @ (
401
+ " $targetSupport /UnitySetup-Universal-Windows-Platform-Support-for-Editor-$Version .$installerExtension " );
402
+ }
403
+
373
404
switch ($currentOS ) {
374
405
([OperatingSystem ]::Windows) {
375
406
$setupComponent = [UnitySetupComponent ]::Windows
@@ -589,10 +620,11 @@ function Select-UnitySetupInstaller {
589
620
}
590
621
591
622
# Keep only the matching component(s).
592
- $Installers = $Installers | Where-Object { $Components -band $_.ComponentType } | ForEach-Object { $_ }
593
-
594
- if ($Installers.Length -ne 0 ) {
595
- $selectedInstallers += $Installers
623
+ foreach ($installer in $Installers ) {
624
+ $versionComponents = ConvertTo-UnitySetupComponent $Components - Version $installer.Version
625
+ if ( $versionComponents -band $_.ComponentType ) {
626
+ $selectedInstallers += $installer
627
+ }
596
628
}
597
629
}
598
630
end {
0 commit comments