Skip to content

Powershell module for interfacing with Unity installs and projects.

License

Notifications You must be signed in to change notification settings

timGerken/unitysetup.powershell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Setup Powershell Module

This PowerShell module contains tools for managing and automating your Unity installs and projects.

Builds

Master

Build status

The master branch is automatically built and deployed to the PowerShell Gallery.

Develop

Build status

The develop branch is automatically built and deployed as a prerelease module to the PowerShell Gallery.

Installation

Install-Module UnitySetup -Scope CurrentUser

Using

Cmdlets

Find all of your Unity installs:

Get-UnitySetupInstance

# Example output:
# Version                                          Components Path
# -------                                          ---------- ----
# 2017.1.2f1                       Windows, UWP, UWP_IL2CPP C:\Program Files\Unity-2017.1.2f1\
# 2017.1.3f1                       Windows, UWP, UWP_IL2CPP C:\Program Files\Unity-2017.1.3f1\
# 2017.2.1f1                       Windows, UWP, UWP_IL2CPP C:\Program Files\Unity-2017.2.1f1\
# 2017.3.1f1       Windows, UWP, UWP_IL2CPP, Linux, Vuforia C:\Program Files\Unity-2017.3.1f1\
# 2018.1.0b4              Windows, UWP, UWP_IL2CPP, Vuforia C:\Program Files\Unity-2018.1.0b4\
# 2018.1.0b8                                              All C:\Program Files\Unity-2018.1.0b8\
# 2017.1.0p5                       Windows, UWP, UWP_IL2CPP C:\Program Files\Unity.2017.1.0p5\
# 2017.1.1f1                       Windows, UWP, UWP_IL2CPP C:\Program Files\Unity.2017.1.1f1\
# 2017.1.1p3       Windows, StandardAssets, UWP, UWP_IL2CPP C:\Program Files\Unity.2017.1.1p3\
# 2017.2.0f3              Windows, UWP, UWP_IL2CPP, Vuforia C:\Program Files\Unity.2017.2.0f3\
# 2017.3.0f3         Windows, UWP, UWP_IL2CPP, Mac, Vuforia C:\Program Files\Unity.2017.3.0f3\

Select the Unity installs that you want:

Get-UnitySetupInstance | Select-UnitySetupInstance -Latest
Get-UnitySetupInstance | Select-UnitySetupInstance -Version '2017.1.1f1'
Get-UnitySetupInstance | Select-UnitySetupInstance -Project '.\MyUnityProject'

Find all the Unity projects recursively:

Get-UnityProjectInstance -Recurse

# Example output:
# Version    Path
# -------    ----
# 2017.2.0f3 C:\Projects\Project1\OneUnity\                 
# 2017.3.0f3 C:\Projects\Project1\TwoUnity\                 
# 2017.1.1p1 C:\Projects\Project2\                          
# 2017.1.2f1 C:\Projects\Project3\App.Unity\                

Launch the right Unity editor for a project:

Start-UnityEditor
Start-UnityEditor -Project .\MyUnityProject
Start-UnityEditor -Project .\MyUnityProject -Latest
Start-UnityEditor -Project .\MyUnityProject -Version '2017.3.0f3'

Launch many projects at the same time:

Get-UnityProjectInstance -Recurse | Start-UnityEditor

Invoke methods with arbitrary arguments:

Start-UnityEditor -ExecuteMethod Build.Invoke -BatchMode -Quit -LogFile .\build.log -Wait -AdditionalArguments "-BuildArg1 -BuildArg2"

Find the installers for a particular version:

Find-UnitySetupInstaller -Version '2017.3.0f3' | Format-Table

# Example output:
#  ComponentType Version       Length LastModified          DownloadUrl
#  ------------- -------       ------ ------------          -----------
#        Windows 2017.3.0f3 553688024 12/18/2017 8:05:31 AM https://download.unity3d.com/download_unity/...
#          Linux 2017.3.0f3 122271984 12/18/2017 8:06:53 AM https://download.unity3d.com/download_unity/...
#            Mac 2017.3.0f3  28103888 12/18/2017 8:06:53 AM https://download.unity3d.com/download_unity/...
#  Documentation 2017.3.0f3 358911256 12/18/2017 8:07:34 AM https://download.unity3d.com/download_unity/...
# StandardAssets 2017.3.0f3 189886032 12/18/2017 8:05:50 AM https://download.unity3d.com/download_unity/...
#          UWP 2017.3.0f3 172298008 12/18/2017 8:07:04 AM https://download.unity3d.com/download_unity/...
#     UWP_IL2CPP 2017.3.0f3 152933480 12/18/2017 8:07:10 AM https://download.unity3d.com/download_unity/...
#        Android 2017.3.0f3 194240888 12/18/2017 8:05:58 AM https://download.unity3d.com/download_unity/...
#            iOS 2017.3.0f3 802853872 12/18/2017 8:06:46 AM https://download.unity3d.com/download_unity/...
#        AppleTV 2017.3.0f3 273433528 12/18/2017 8:06:09 AM https://download.unity3d.com/download_unity/...
#       Facebook 2017.3.0f3  32131560 12/18/2017 8:06:12 AM https://download.unity3d.com/download_unity/...
#        Vuforia 2017.3.0f3  65677296 12/18/2017 8:07:12 AM https://download.unity3d.com/download_unity/...
#          WebGL 2017.3.0f3 134133288 12/18/2017 8:07:19 AM https://download.unity3d.com/download_unity/...

Limit what components you search for:

Find-UnitySetupInstaller -Version 2017.3.0f3 -Components 'Windows','Documentation' | Format-Table

# Example output:
# ComponentType Version       Length LastModified          DownloadUrl
# ------------- -------       ------ ------------          -----------
#       Windows 2017.3.0f3 553688024 12/18/2017 8:05:31 AM https://download.unity3d.com/download_unity/...
# Documentation 2017.3.0f3 358911256 12/18/2017 8:07:34 AM https://download.unity3d.com/download_unity/...

Install UnitySetup instances:

# Pipeline is supported, but downloads, then installs, then downloads, etc.
Find-UnitySetupInstaller -Version '2017.3.0f3' | Install-UnitySetupInstance

# This will issue all downloads together, then install each.
Install-UnitySetupInstance -Installers (Find-UnitySetupInstaller -Version '2017.3.0f3')

Manage Unity licenses.

# Get any active licenses
Get-UnityLicense

# Example Output:
# LicenseVersion : 6.x
# Serial         : System.Security.SecureString
# UnityVersion   : 2017.4.2f2
# DisplaySerial  : AB-CDEF-GHIJ-KLMN-OPQR-XXXX
# ActivationDate : 2017-07-13 16:32:16
# StartDate      : 2017-07-12 00:00:00
# StopDate       : 2019-01-01 00:00:00
# UpdateDate     : 2018-05-11 23:47:10

# Activate a license
Start-UnityEditor -Credential <unityAccount> -Serial <unitySerial> -Wait

# Return license
Start-UnityEditor -Credential <unityAccount> -ReturnLicense -Wait

DSC

UnitySetup includes the xUnitySetupInstance DSC Resource. An example configuration might look like:

<#
    Install multiple versions of Unity and several components
#>
Configuration Sample_xUnitySetupInstance_Install {
    param(
        [PSCredential]$UnityCredential,
        [PSCredential]$UnitySerial
    )

    Import-DscResource -ModuleName UnitySetup

    Node 'localhost' {

        xUnitySetupInstance Unity {
            Versions = '2017.4.2f2,2018.1.0f2'
            Components = 'Windows', 'Mac', 'Linux', 'UWP', 'iOS'
            Ensure = 'Present'
        }

        xUnityLicense UnityLicense {
            Name = 'UL01'
            Credential = $UnityCredential
            Serial = $UnitySerial
            Ensure = 'Present'
            UnityVersion = '2017.4.2f2'
            DependsOn = '[xUnitySetupInstance]Unity'   
        }
    }
}

See more by perusing the UnitySetup\Examples folder.

Feedback

To file issues or suggestions, please use the Issues page for this project on GitHub.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [email protected]. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

About

Powershell module for interfacing with Unity installs and projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PowerShell 100.0%