@@ -290,15 +290,38 @@ function Get-UnityEditor {
290290 Help to create UnitySetupComponent
291291. PARAMETER Components
292292 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
293296. EXAMPLE
294297 ConvertTo-UnitySetupComponent Windows,UWP
298+ . EXAMPLE
299+ ConvertTo-UnitySetupComponent Windows,UWP -Version 2019.3.4f1
295300#>
296301function ConvertTo-UnitySetupComponent {
297302 [CmdletBinding ()]
298303 param (
299304 [parameter (Mandatory = $true , Position = 0 )]
300- [UnitySetupComponent ] $Component
305+ [UnitySetupComponent ] $Component ,
306+ [parameter (Mandatory = $false )]
307+ [UnityVersion ] $Version
301308 )
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+ }
302325
303326 $Component
304327}
@@ -327,6 +350,8 @@ function Find-UnitySetupInstaller {
327350 [UnitySetupComponent ] $Components = [UnitySetupComponent ]::All
328351 )
329352
353+ $Components = ConvertTo-UnitySetupComponent - Component $Components - Version $Version
354+
330355 $currentOS = Get-OperatingSystem
331356 switch ($currentOS ) {
332357 ([OperatingSystem ]::Windows) {
@@ -370,6 +395,12 @@ function Find-UnitySetupInstaller {
370395 [UnitySetupComponent ]::Lumin = , " $targetSupport /UnitySetup-Lumin-Support-for-Editor-$Version .$installerExtension " ;
371396 }
372397
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+
373404 switch ($currentOS ) {
374405 ([OperatingSystem ]::Windows) {
375406 $setupComponent = [UnitySetupComponent ]::Windows
@@ -589,10 +620,11 @@ function Select-UnitySetupInstaller {
589620 }
590621
591622 # 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+ }
596628 }
597629 }
598630 end {
0 commit comments