From dd03ec0450dc6f00625d3a4de349f188bfacd0e6 Mon Sep 17 00:00:00 2001 From: Niall Milsom Date: Mon, 4 Mar 2019 14:08:05 +0000 Subject: [PATCH 1/2] Add AdditionalArguments flag This flag allows you to provide additional arguments for unity command line. This is useful for cases where we do not support unity command line flags. It is also useful for providing arbitrary arguments alongside ExecuteMethod. --- UnitySetup/UnitySetup.psm1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index 30db7fe..de6105d 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -754,6 +754,8 @@ function Get-UnityProjectInstance { Force operation as though $PWD is not a unity project. .PARAMETER ExecuteMethod The script method for the Unity Editor to execute. +.PARAMETER AdditionalArguments + Additiong arguments for Unity or your custom method .PARAMETER OutputPath The output path that the Unity Editor should use. .PARAMETER LogFile @@ -825,6 +827,8 @@ function Start-UnityEditor { [parameter(Mandatory = $false)] [string]$ExecuteMethod, [parameter(Mandatory = $false)] + [string]$AdditionalArguments, + [parameter(Mandatory = $false)] [string[]]$ExportPackage, [parameter(Mandatory = $false)] [string]$ImportPackage, @@ -962,6 +966,7 @@ function Start-UnityEditor { if ( $TestResults ) { $sharedArgs += '-testResults', $TestResults } if ( $RunTests ) { $sharedArgs += '-runTests' } if ( $ForceFree) { $sharedArgs += '-force-free' } + if ( $AdditionalArguments) { $sharedArgs += $AdditionalArguments } $instanceArgs = @() foreach ( $p in $projectInstances ) { From c2935c66debe0f1c1580a25990301f7dbe373c8d Mon Sep 17 00:00:00 2001 From: Niall Milsom Date: Tue, 5 Mar 2019 15:53:47 +0000 Subject: [PATCH 2/2] Fix typo and add to docs --- README.md | 4 ++++ UnitySetup/UnitySetup.psd1 | 2 +- UnitySetup/UnitySetup.psm1 | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 86a8ae4..b882b2d 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,10 @@ Launch many projects at the same time: ```powershell Get-UnityProjectInstance -Recurse | Start-UnityEditor ``` +Invoke methods with arbitrary arguments: +```powershell +Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait -AdditionalArguments "-BuildArg1 -BuildArg2" +``` Find the installers for a particular version: ```powershell Find-UnitySetupInstaller -Version '2017.3.0f3' | Format-Table diff --git a/UnitySetup/UnitySetup.psd1 b/UnitySetup/UnitySetup.psd1 index 2bc02e1..27b77e0 100644 --- a/UnitySetup/UnitySetup.psd1 +++ b/UnitySetup/UnitySetup.psd1 @@ -14,7 +14,7 @@ RootModule = 'UnitySetup' # Version number of this module. - ModuleVersion = '5.0' + ModuleVersion = '5.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/UnitySetup/UnitySetup.psm1 b/UnitySetup/UnitySetup.psm1 index de6105d..0307f2b 100644 --- a/UnitySetup/UnitySetup.psm1 +++ b/UnitySetup/UnitySetup.psm1 @@ -755,7 +755,7 @@ function Get-UnityProjectInstance { .PARAMETER ExecuteMethod The script method for the Unity Editor to execute. .PARAMETER AdditionalArguments - Additiong arguments for Unity or your custom method + Additional arguments for Unity or your custom method .PARAMETER OutputPath The output path that the Unity Editor should use. .PARAMETER LogFile @@ -797,7 +797,7 @@ function Get-UnityProjectInstance { .EXAMPLE Start-UnityEditor -Version 2017.3.0f3 .EXAMPLE - Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait + Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait -AdditionalArguments "-BuildArg1 -BuildArg2" .EXAMPLE Get-UnityProjectInstance -Recurse | Start-UnityEditor -BatchMode -Quit .EXAMPLE