Skip to content

Commit bb5c127

Browse files
authored
Merge pull request #158 from MenelvagorMilsom/feature/add-additional-args
Add AdditionalArguments flag
2 parents 3e9b623 + c2935c6 commit bb5c127

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ Launch many projects at the same time:
7373
```powershell
7474
Get-UnityProjectInstance -Recurse | Start-UnityEditor
7575
```
76+
Invoke methods with arbitrary arguments:
77+
```powershell
78+
Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait -AdditionalArguments "-BuildArg1 -BuildArg2"
79+
```
7680
Find the installers for a particular version:
7781
```powershell
7882
Find-UnitySetupInstaller -Version '2017.3.0f3' | Format-Table

UnitySetup/UnitySetup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
RootModule = 'UnitySetup'
1515

1616
# Version number of this module.
17-
ModuleVersion = '5.0'
17+
ModuleVersion = '5.1'
1818

1919
# Supported PSEditions
2020
# CompatiblePSEditions = @()

UnitySetup/UnitySetup.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ function Get-UnityProjectInstance {
754754
Force operation as though $PWD is not a unity project.
755755
.PARAMETER ExecuteMethod
756756
The script method for the Unity Editor to execute.
757+
.PARAMETER AdditionalArguments
758+
Additional arguments for Unity or your custom method
757759
.PARAMETER OutputPath
758760
The output path that the Unity Editor should use.
759761
.PARAMETER LogFile
@@ -795,7 +797,7 @@ function Get-UnityProjectInstance {
795797
.EXAMPLE
796798
Start-UnityEditor -Version 2017.3.0f3
797799
.EXAMPLE
798-
Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait
800+
Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait -AdditionalArguments "-BuildArg1 -BuildArg2"
799801
.EXAMPLE
800802
Get-UnityProjectInstance -Recurse | Start-UnityEditor -BatchMode -Quit
801803
.EXAMPLE
@@ -825,6 +827,8 @@ function Start-UnityEditor {
825827
[parameter(Mandatory = $false)]
826828
[string]$ExecuteMethod,
827829
[parameter(Mandatory = $false)]
830+
[string]$AdditionalArguments,
831+
[parameter(Mandatory = $false)]
828832
[string[]]$ExportPackage,
829833
[parameter(Mandatory = $false)]
830834
[string]$ImportPackage,
@@ -962,6 +966,7 @@ function Start-UnityEditor {
962966
if ( $TestResults ) { $sharedArgs += '-testResults', $TestResults }
963967
if ( $RunTests ) { $sharedArgs += '-runTests' }
964968
if ( $ForceFree) { $sharedArgs += '-force-free' }
969+
if ( $AdditionalArguments) { $sharedArgs += $AdditionalArguments }
965970

966971
$instanceArgs = @()
967972
foreach ( $p in $projectInstances ) {

0 commit comments

Comments
 (0)