From 4c70a9cc62b4515458a9819456734d1062adedc0 Mon Sep 17 00:00:00 2001 From: Josh Wittner Date: Tue, 15 Sep 2020 12:14:43 -0700 Subject: [PATCH 1/8] Wrap each path individually in quotes to fix exports --- UnitySetup/UnitySetup.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 5daf628..58db9c0 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -1810,7 +1810,7 @@ function Start-UnityEditor { if ( $BuildTarget ) { $sharedArgs += "-buildTarget", $BuildTarget } if ( $BatchMode ) { $sharedArgs += "-batchmode" } if ( $Quit ) { $sharedArgs += "-quit" } - if ( $ExportPackage ) { $sharedArgs += "-exportPackage", "`"$ExportPackage`"" } + if ( $ExportPackage ) { $sharedArgs += "-exportPackage", ($ExportPackage | ForEach-Object { "`"$_`"" }) } if ( $ImportPackage ) { $sharedArgs += "-importPackage", "`"$ImportPackage`"" } if ( $Credential ) { $sharedArgs += '-username', $Credential.UserName } if ( $EditorTestsCategory ) { $sharedArgs += '-editorTestsCategories', ($EditorTestsCategory -join ',') } From 8155050fe0e7bf211c1e869286ab2fcdb04840ef Mon Sep 17 00:00:00 2001 From: Josh Wittner Date: Tue, 6 Jul 2021 13:44:20 -0700 Subject: [PATCH 2/8] Support Linux_IL2CPP component --- UnitySetup/UnitySetup.psm1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 802ec67..5b7240c 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -21,7 +21,8 @@ enum UnitySetupComponent { WebGL = (1 -shl 13) Mac_IL2CPP = (1 -shl 14) Lumin = (1 -shl 15) - All = (1 -shl 16) - 1 + Linux_IL2CPP = (1 -shl 16) + All = (1 -shl 17) - 1 } [Flags()] @@ -68,7 +69,8 @@ class UnitySetupInstance { [UnitySetupComponent]::UWP = [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_.NET_D3D"), [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_D3D"); [UnitySetupComponent]::UWP_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_IL2CPP_D3D"); - [UnitySetupComponent]::Linux = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport"); + [UnitySetupComponent]::Linux = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport\Variations\linux64_headless_development_mono"); + [UnitySetupComponent]::Linux_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport\Variations\linux64_headless_development_il2cpp"); [UnitySetupComponent]::Mac = , [io.path]::Combine("$playbackEnginePath", "MacStandaloneSupport"); } } @@ -85,7 +87,8 @@ class UnitySetupInstance { [UnitySetupComponent]::StandardAssets = , [io.path]::Combine("$Path", "Standard Assets"); [UnitySetupComponent]::Mac_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "MacStandaloneSupport/Variations/macosx64_development_il2cpp"); [UnitySetupComponent]::Windows = , [io.path]::Combine("$playbackEnginePath", "WindowsStandaloneSupport"); - [UnitySetupComponent]::Linux = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport"); + [UnitySetupComponent]::Linux = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport/Variations/linux64_headless_development_mono"); + [UnitySetupComponent]::Linux_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport/Variations/linux64_headless_development_il2cpp"); } } } @@ -404,6 +407,7 @@ function Find-UnitySetupInstaller { [UnitySetupComponent]::WebGL = , "$targetSupport/UnitySetup-WebGL-Support-for-Editor-$Version.$installerExtension"; [UnitySetupComponent]::Windows_IL2CPP = , "$targetSupport/UnitySetup-Windows-IL2CPP-Support-for-Editor-$Version.$installerExtension"; [UnitySetupComponent]::Lumin = , "$targetSupport/UnitySetup-Lumin-Support-for-Editor-$Version.$installerExtension"; + [UnitySetupComponent]::Linux_IL2CPP = , "$targetSupport/UnitySetup-Linux-IL2CPP-Support-for-Editor-$Version.$installerExtension"; } # In 2019.x there is only IL2CPP UWP so change the search for UWP_IL2CPP From f6f807f6cfc8479d8e63c5a3f3f084b22b173845 Mon Sep 17 00:00:00 2001 From: Josh Wittner Date: Tue, 6 Jul 2021 14:24:33 -0700 Subject: [PATCH 3/8] Performance enhancements for Get-UnitySetupInstaller --- UnitySetup/UnitySetup.psm1 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 802ec67..014ec30 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -1265,10 +1265,24 @@ function Get-UnitySetupInstanceVersion { } # Search through any header files which might define the unity version - Write-Verbose "Looking for .h files with UNITY_VERSION defined under $path\Editor\ " - $headerMatchInfo = Get-ChildItem -Path "$path\Editor\*.h" -Recurse -ErrorAction Ignore -Force -File | - Select-String -Pattern "UNITY_VERSION\s`"(\d+\.\d+\.\d+[fpba]\d+)`"" | - Select-Object -First 1 + [string[]]$knownHeaders = @( + "$path\Editor\Data\PlaybackEngines\windowsstandalonesupport\Source\WindowsPlayer\WindowsPlayer\UnityConfigureVersion.gen.h" + ) + foreach ($header in $knownHeaders) { + Write-Verbose "Looking for UNITY_VERSION defined in $header" + if (Test-Path -PathType Leaf -Path $header) { + $headerMatchInfo = Select-String -Path $header -Pattern "UNITY_VERSION\s`"(\d+\.\d+\.\d+[fpba]\d+)`"" + } + } + + if ($null -eq $headerMatchInfo) { + Write-Verbose "Looking for .h files with UNITY_VERSION defined under $path\Editor\ " + $headerMatchInfo = do { + Get-ChildItem -Path "$path\Editor\*.h" -Recurse -ErrorAction Ignore -Force -File | + Select-String -Pattern "UNITY_VERSION\s`"(\d+\.\d+\.\d+[fpba]\d+)`"" | + ForEach-Object { $_; break; } # Stop the pipeline after the first result + } while ($false); + } if ( $headerMatchInfo.Matches.Groups.Count -gt 1 ) { Write-Verbose "`tFound version!" From e2a115f410c31e72494d9679d15b4d6c343e2e92 Mon Sep 17 00:00:00 2001 From: cartwrightluke Date: Thu, 16 Sep 2021 13:58:23 -0700 Subject: [PATCH 4/8] Added private build support Add the option to specify a Hash parameter when calling Find-UnitySetupInstaller, which looks for URIs using the hash provided, rather than detecting it based on the public builds available on the download archive page. --- UnitySetup/UnitySetup.psm1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 6412cb1..9ebc157 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -344,6 +344,8 @@ function ConvertTo-UnitySetupComponent { Finds UnitySetup component installers for a specified version by querying Unity's website. .PARAMETER Version What version of Unity are you looking for? +.PARAMETER Hash + Manually specify the build hash, to select a private build. .PARAMETER Components What components would you like to search for? Defaults to All .EXAMPLE @@ -358,7 +360,10 @@ function Find-UnitySetupInstaller { [UnityVersion] $Version, [parameter(Mandatory = $false)] - [UnitySetupComponent] $Components = [UnitySetupComponent]::All + [UnitySetupComponent] $Components = [UnitySetupComponent]::All, + + [parameter(Mandatory = $false)] + [string] $Hash = "" ) $Components = ConvertTo-UnitySetupComponent -Component $Components -Version $Version @@ -514,6 +519,10 @@ function Find-UnitySetupInstaller { $knownBaseUrls = $knownBaseUrls | Sort-Object -Property @{ Expression = { [math]::Abs(($_.CompareTo($linkComponents[0]))) }; Ascending = $true } } + if ($Hash -ne "") { + $linkComponents[1] = $Hash + } + $installerTemplates.Keys | Where-Object { $Components -band $_ } | ForEach-Object { $templates = $installerTemplates.Item($_); $result = $null From 0a5d2bbf971bb1e4b1a80591ac1d69883c34b664 Mon Sep 17 00:00:00 2001 From: Josh Wittner Date: Thu, 16 Sep 2021 14:07:39 -0700 Subject: [PATCH 5/8] Bump minor version --- UnitySetup/UnitySetup.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitySetup/UnitySetup.psd1 b/UnitySetup/UnitySetup.psd1 index 791e86a..d62ef11 100644 --- a/UnitySetup/UnitySetup.psd1 +++ b/UnitySetup/UnitySetup.psd1 @@ -14,7 +14,7 @@ RootModule = 'UnitySetup' # Version number of this module. - ModuleVersion = '5.4' + ModuleVersion = '5.5' # Supported PSEditions # CompatiblePSEditions = @() From 3c7f7520eebe9e7ce5358775e7a620d46c48b5f0 Mon Sep 17 00:00:00 2001 From: Josh Wittner Date: Mon, 15 Nov 2021 12:18:13 -0800 Subject: [PATCH 6/8] Fix for detecting unity 2021 version and windows il2cpp --- UnitySetup/UnitySetup.psm1 | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 9ebc157..a0df5cc 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -64,7 +64,8 @@ class UnitySetupInstance { @{ [UnitySetupComponent]::Documentation = , [io.path]::Combine("$Path", "Editor\Data\Documentation"); [UnitySetupComponent]::StandardAssets = , [io.path]::Combine("$Path", "Editor\Standard Assets"); - [UnitySetupComponent]::Windows_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "windowsstandalonesupport\Variations\win32_development_il2cpp"); + [UnitySetupComponent]::Windows_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "windowsstandalonesupport\Variations\win32_development_il2cpp"), + [io.path]::Combine("$playbackEnginePath", "windowsstandalonesupport\Variations\win32_player_development_il2cpp");; [UnitySetupComponent]::UWP = [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_.NET_D3D"), [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_D3D"); [UnitySetupComponent]::UWP_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_IL2CPP_D3D"); @@ -1274,28 +1275,33 @@ function Get-UnitySetupInstanceVersion { } # Search through any header files which might define the unity version - [string[]]$knownHeaders = @( - "$path\Editor\Data\PlaybackEngines\windowsstandalonesupport\Source\WindowsPlayer\WindowsPlayer\UnityConfigureVersion.gen.h" + [string[]]$knownFiles = @( + "$path\Editor\Data\PlaybackEngines\windowsstandalonesupport\Source\WindowsPlayer\WindowsPlayer\UnityConfigureVersion.gen.h", + "$path\Editor\Data\PlaybackEngines\windowsstandalonesupport\Source\WindowsPlayer\WindowsPlayer\UnityConfiguration.gen.cpp" ) - foreach ($header in $knownHeaders) { - Write-Verbose "Looking for UNITY_VERSION defined in $header" - if (Test-Path -PathType Leaf -Path $header) { - $headerMatchInfo = Select-String -Path $header -Pattern "UNITY_VERSION\s`"(\d+\.\d+\.\d+[fpba]\d+)`"" + foreach ($file in $knownFiles) { + Write-Verbose "Looking for UNITY_VERSION defined in $file" + if (Test-Path -PathType Leaf -Path $file) { + $fileMatchInfo = Select-String -Path $file -Pattern "UNITY_VERSION.+`"(\d+\.\d+\.\d+[fpba]\d+).*`"" + if($null -ne $fileMatchInfo) + { + break; + } } } - if ($null -eq $headerMatchInfo) { - Write-Verbose "Looking for .h files with UNITY_VERSION defined under $path\Editor\ " - $headerMatchInfo = do { - Get-ChildItem -Path "$path\Editor\*.h" -Recurse -ErrorAction Ignore -Force -File | - Select-String -Pattern "UNITY_VERSION\s`"(\d+\.\d+\.\d+[fpba]\d+)`"" | + if ($null -eq $fileMatchInfo) { + Write-Verbose "Looking for source files with UNITY_VERSION defined under $path\Editor\ " + $fileMatchInfo = do { + Get-ChildItem -Path "$path\Editor" -Include '*.cpp','*.h' -Recurse -ErrorAction Ignore -Force -File | + Select-String -Pattern "UNITY_VERSION.+`"(\d+\.\d+\.\d+[fpba]\d+).*`"" | ForEach-Object { $_; break; } # Stop the pipeline after the first result } while ($false); } - if ( $headerMatchInfo.Matches.Groups.Count -gt 1 ) { + if ( $fileMatchInfo.Matches.Groups.Count -gt 1 ) { Write-Verbose "`tFound version!" - return [UnityVersion]($headerMatchInfo.Matches.Groups[1].Value) + return [UnityVersion]($fileMatchInfo.Matches.Groups[1].Value) } } } From 7aaee15853c1fcf73d8b475c2b6d5378e06dde76 Mon Sep 17 00:00:00 2001 From: jossanta Date: Thu, 9 Jun 2022 14:07:47 +0100 Subject: [PATCH 7/8] Add unity accelerator parameters --- UnitySetup/UnitySetup.psm1 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 0652331..4789781 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -1761,7 +1761,15 @@ function Start-UnityEditor { [parameter(Mandatory = $false)] [switch]$Wait, [parameter(Mandatory = $false)] - [switch]$PassThru + [switch]$PassThru, + [parameter(Mandatory = $false)] + [string]$CacheServerEndpoint, + [parameter(Mandatory = $false)] + [string]$CacheServerNamespacePrefix, + [parameter(Mandatory = $false)] + [switch]$CacheServerDisableDownload, + [parameter(Mandatory = $false)] + [switch]$CacheServerDisableUpload ) process { switch -wildcard ( $PSCmdlet.ParameterSetName ) { @@ -1855,6 +1863,14 @@ function Start-UnityEditor { if ( $RunTests ) { $sharedArgs += '-runTests' } if ( $ForceFree) { $sharedArgs += '-force-free' } if ( $AdditionalArguments) { $sharedArgs += $AdditionalArguments } + if ( $CacheServerEndpoint) { + $sharedArgs += "-cacheServerEndpoint", $CacheServerEndpoint + $sharedArgs += "-adb2" + $sharedArgs += "-enableCacheServer" + if ( $CacheServerNamespacePrefix) { $sharedArgs += "-cacheServerNamespacePrefix", $CacheServerNamespacePrefix} + $sharedArgs += "-cacheServerEnableDownload", $(If ($CacheServerDisableDownload) {"false"} Else {"true"}) + $sharedArgs += "-cacheServerEnableUpload", $(If ($CacheServerDisableUpload) {"false"} Else {"true"}) + } [string[][]]$instanceArgs = @() foreach ( $p in $projectInstances ) { From 4d1487c37eaa63e21d04242a0e309c1649a815fe Mon Sep 17 00:00:00 2001 From: jossanta Date: Fri, 10 Jun 2022 12:32:08 +0100 Subject: [PATCH 8/8] Adding some docs and examples --- README.md | 8 ++++++++ UnitySetup/UnitySetup.psm1 | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index c7c527b..9471d28 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,14 @@ Start-UnityEditor -Project .\MyUnityProject Start-UnityEditor -Project .\MyUnityProject -Latest Start-UnityEditor -Project .\MyUnityProject -Version '2017.3.0f3' ``` + +Using the [Unity Accelerator](https://docs.unity3d.com/2019.3/Documentation/Manual/UnityAccelerator.html): +```powershell +Start-UnityEditor -Project .\MyUnityProject -CacheServerEndpoint 192.168.0.23 +Start-UnityEditor -Project .\MyUnityProject -CacheServerEndpoint 192.168.0.23:2523 -CacheServerNamespacePrefix "dev" +Start-UnityEditor -Project .\MyUnityProject -CacheServerEndpoint 192.168.0.23 -CacheServerNamespacePrefix "dev" -CacheServerDisableDownload +Start-UnityEditor -Project .\MyUnityProject -CacheServerEndpoint 192.168.0.23 -CacheServerDisableUpload +``` Launch many projects at the same time: ```powershell Get-UnityProjectInstance -Recurse | Start-UnityEditor diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 4789781..a7cb3c8 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -1678,6 +1678,14 @@ function Test-UnityProjectInstanceMetaFileIntegrity { Should the Unity Editor quit after it's done? .PARAMETER Wait Should the command wait for the Unity Editor to exit? +.PARAMETER CacheServerEndpoint + If included, the editor will attempt to use a Unity Accelerator hosted in the provided IP. The endpoint should be in the format of [IP]:[Port]. If the default Accelerator port is used, at the time of writing this, the port should be ommited. +.PARAMETER CacheServerNamespacePrefix + Set the namespace prefix. Used to group data together on the cache server. +.PARAMETER CacheServerDisableDownload + Disable downloading from the cache server. If ommited, the default value is true (download enabled) +.PARAMETER CacheServerDisableUpload + Disable uploading to the cache server. If ommited, the default value is true (upload enabled) .EXAMPLE Start-UnityEditor .EXAMPLE