Code Monkey home page Code Monkey logo

unitysetup.powershell's Issues

Support *nix platforms

PowerShell Core is now cross-platform. We should investigate supporting the *nix world, including Mac.

Mac

  • Find-UnitySetupInstaller
  • Get-UnityProjectInstance
  • Get-UnitySetupInstance
  • Install-UnitySetupInstance
  • Select-UnitySetupInstance
  • Uninstall-UnitySetupInstance
  • Start-UnityEditor
  • ConvertTo-UnitySetupComponent
  • Get-UnityLicense

Linux

  • Find-UnitySetupInstaller
  • Get-UnityProjectInstance
  • Get-UnitySetupInstance
  • Install-UnitySetupInstance
  • Select-UnitySetupInstance
  • Uninstall-UnitySetupInstance
  • Start-UnityEditor
  • ConvertTo-UnitySetupComponent
  • Get-UnityLicense

Start-BitsTransfer cannot be leveraged in some instances

in Install-UnitySetupInstance
the line
Start-BitsTransfer -Source $downloadSource -Destination $downloadDest

fails if it's executed from a Visual Studio Team Services build agent with as the VSTS Agent runs as a service.
2018-08-03T17:31:03.2273217Z DEBUG: 472+ >>>> Start-BitsTransfer -Source $downloadSource -Destination $downloadDest
2018-08-03T17:31:03.7159554Z Start-BitsTransfer : The operation being requested was not performed because the user has not logged on to the
2018-08-03T17:31:03.7159834Z network. The specified service does not exist. (Exception from HRESULT: 0x800704DD)
2018-08-03T17:31:03.7160174Z At C:\Program Files\WindowsPowerShell\Modules\UnitySetup\4.0.97\UnitySetup.psm1:472 char:13

Either credentials need to be supplied to the call (and piped through as params) or it should use webclient to download the installer
(New-Object System.Net.WebClient).DownloadFile([string]$downloadSource, [string]$downloadDest)

I'm testing this E2E now.

*-UnitySetup API should align with Package/Module APIs already well known.

  • Find-UnitySetupInstaller -> Find-UnitySetupInstance, should find all versions if called without flags.
  • Install-UnitySetupInstance -> Shouldn't require installers from Find.
  • Get-UnitySetupInstance -> Should support filters from Select-UnitySetupInstance
  • Select-UnitySetupInstance -> Drop cmdlet entirely
  • Update-UnitySetupInstance -> Should install latest version, use flags to signal patch or beta allowed.

Install-UnitySetupInstance could be more asyncronous

Right now it downloads them one at a time then installs all. It should download them all asynchronously, when the main installer for the platform is done it should install that, then it should install components as they finish downloading.

Examples Component Installing Over Unity.exe

Attempting to download 2017.1.1p1 with this command: Find-UnitySetupInstaller -Version '2017.1.2f1' | Install-UnitySetupInstance.

Installer gets to UnityExampleProjectSetup-2017.1.1p1.exe and installs fine. Noticed after this install the Unity install directory is overwritten with the example scene. Unity.exe is now deleted and thus the installation is now borked.

capture

Install-UnitySetupInstance on a narrow PowerShell window -> lots of output spam

  1. Open a PowerShell window and slide the right edge so it isn't very wide
  2. Run Install-UnitySetupInstance (e.g. Find-UnitySetupInstaller -Version '2017.3.1p1' -Components Setup | Install-UnitySetupInstance)

result: Script attempts to update its progress spinner, ends up printing lots of output:

Installing C:\Users\forrest\.unitysetup\Installers\Unity-2017.3.1p1\UnitySetup64-2017.3.1p1.exe to C:\Program Files\UnitInstalling C:\Users\forrest\.unitysetup\Installers\Unity-2017.3.1p1\UnitySetup64-2017.3.1p1.exe to C:\Program Files\UnitInstalling C:\Users\forrest\.unitysetup\Installers\Unity-2017.3.1p1\UnitySetup64-2017.3.1p1.exe to C:\Program Files\UnitInstalling C:\Users\forrest\.unitysetup\Installers\Unity-2017.3.1p1\UnitySetup64-2017.3.1p1.exe to C:\Program Files\UnitInstalling C:\Users\forrest\.unitysetup\Installers\Unity-2017.3.1p1\UnitySetup64-2017.3.1p1.exe to C:\Program Files\UnitInstalling C:\User...

expected: Progress spinner outputs in place or output is more sparing/organized.

Start-UnityEditor should install missing Versions

If the version is not installed, the function should perform the -MissingVersionAction, which can be any of Confirm, ConfirmVersion, Install, Fallback, Error

MissingVersionAction, defaults to Confirm.

Example 'Confirm' output:

Would you like to?

[A] Install the missing version or [B] launch with latest version or [C] Specify a version or [D] Cancel.
C
What version?
>

Using ConfirmVersion skips the initial prompt, and asks just what version you'd like to use. Install auto installs without asking. Latest launches with the latest installed version. Error results in the exception we see now.

Note that defaulting to Confirm means a major version bump to account for the change in behavior. We could default to Error and make this a minor version bump. We could export a variable to control the default - $UnitySetupMissingVersionActionPreference so that people can change their default.

Patch builds off the front page for a version are not found by Find-UnitySetupInstaller

My Example:

C:\WINDOWS\system32> $installers = Find-UnitySetupInstaller -Version 2017.2.0p3 -Components Setup -Verbose
VERBOSE: GET https://unity3d.com/unity/qa/patch-releases?version=2017.2 with 0-byte payload
VERBOSE: received 73560-byte response of content type text/html; charset=utf-8
VERBOSE: GET https://unity3d.com/unity/qa/patch-releases?version=2017.2 with 0-byte payload
VERBOSE: received 73560-byte response of content type text/html; charset=utf-8
Could not find archives for Unity version 2017.2.0p3
At C:\Users\jowitt\Documents\WindowsPowerShell\Modules\UnitySetup\3.0.80\UnitySetup.psm1:257 char:9
+         throw "Could not find archives for Unity version $Version"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find ...sion 2017.2.0p3:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find archives for Unity version 2017.2.0p3

Looks like the regex against the page urls is failing now.

exiting Unity launched from PowerShell spews "leaked weakptr" to PowerShell console

  1. Run Start-UnityEditor to run the Unity.
  2. Close Unity after it launches.
    result: Extra output is written to the console:
Checking for leaked weakptr:
  Found no leaked weakptrs.
##utp:{"type":"MemoryLeaks","allocatedMemory":25398947,"memoryLabels":[{"Default":3148},{"NewDelete":6397012},{"Manager":224},{"Texture":480},{"TextureCache":-480},{"FMOD":640},{"Physics":1},{"Serialization":29792},{"Terrain":224},{"String":39656},{"DynamicArray":30073},{"HashMap":18846208},{"Curl":1528},{"PoolAlloc":-224},{"Sprites":8},{"CloudService":-2360},{"VR":1704},{"EditorGui":280},{"EditorUtility":35680},{"AssetImporter":32},{"RestService":72},{"EditorGi":5785},{"UnityConnect":9376},{"Collab":720},{"Upm":-632}]}

expected: No additional output.

PSScriptAnalyzer has warnings

Running Invoke-ScriptAnalyzer UnitySetup\UnitySetup.psm1 results in

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSUseShouldProcessForStateChangingF Warning      UnitySetup 492   Function ’Start-UnityEditor’ has verb that could change
unctions                                         .psm1            system state. Therefore, the function has to support
                                                                  'ShouldProcess'.
PSAvoidUsingWriteHost               Warning      UnitySetup 303   File 'UnitySetup.psm1' uses Write-Host. Avoid using
                                                 .psm1            Write-Host because it might not work in all hosts, does not
                                                                  work when there is no host, and (prior to PS 5.0) cannot be
                                                                  suppressed, captured, or redirected. Instead, use
                                                                  Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost               Warning      UnitySetup 309   File 'UnitySetup.psm1' uses Write-Host. Avoid using
                                                 .psm1            Write-Host because it might not work in all hosts, does not
                                                                  work when there is no host, and (prior to PS 5.0) cannot be
                                                                  suppressed, captured, or redirected. Instead, use
                                                                  Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost               Warning      UnitySetup 314   File 'UnitySetup.psm1' uses Write-Host. Avoid using
                                                 .psm1            Write-Host because it might not work in all hosts, does not
                                                                  work when there is no host, and (prior to PS 5.0) cannot be
                                                                  suppressed, captured, or redirected. Instead, use
                                                                  Write-Output, Write-Verbose, or Write-Information.

PowerShell Core 6 - Find-UnitySetupInstaller Issues

  • Fresh PowerShell Core 6 install.
  • Windows 10 Falls Creator's Update
  • Install-Module UnitySetup -Scope CurrentUser to install UnitySetup.

Running the one example Find-UnitySetupInstaller -Version '2017.3.0f3' | Format-Table outputs:

WARNING: Unable to find installer for the WebGL component.
WARNING: Unable to find installer for the Metro component.
WARNING: Unable to find installer for the StandardAssets component.
WARNING: Unable to find installer for the Windows component.
WARNING: Unable to find installer for the UWP_IL2CPP component.
WARNING: Unable to find installer for the AppleTV component.
WARNING: Unable to find installer for the Vuforia component.
WARNING: Unable to find installer for the Windows_IL2CPP component.
WARNING: Unable to find installer for the Documentation component.
WARNING: Unable to find installer for the iOS component.
WARNING: Unable to find installer for the Mac component.
WARNING: Unable to find installer for the Android component.
WARNING: Unable to find installer for the Linux component.
WARNING: Unable to find installer for the Facebook component.

I'm able to run other commands like Get-UnitySetupInstance.

Installing the module in PowerShell on the same machine works just fine.

Start-UnityEditor should parse and summarize errors when Unity exits

Our build process launches the Unity editor using the Start-UnityEditor. We often end up with errors such as "Start-UnityEditor : Unity quit with non-zero exit code: 1." when our build fails.

It can be time-consuming to search a large Unity log for errors. It would be awesome if Start-UnityEditor could understand Unity's log file and pull out error messages and summarized them in its error output.

QA "p" releases are not being found

PS C:\Users\bryce> Find-UnitySetupInstaller -Version 2017.3.0p4 -Components Setup
Could not find archives for Unity version 2017.3.0p4
At C:\Users\bryce\OneDrive\Documents\WindowsPowerShell\Modules\UnitySetup\2.1.43\UnitySetup.psm1:204 char:9
+         throw "Could not find archives for Unity version $Version"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find ...sion 2017.3.0p4:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find archives for Unity version 2017.3.0p4

It seems to fail on any "p" releases. I got the version numbers from the Patch Releases page. Other release types seem to be working correctly.

Can't install without Admin pop up

Add a -Verb param to Install-UnitySetupInstance that forwards to the start-process call so that as an admin I can launch Unity as an admin.

Undescriptive Error for Start-UnityEditor

When you try to start a unity editor for a project that has an uninstalled unity version, you get an error that doesn't make it clear that you must install the corresponding unity version.

Input:
Start-UnityEditor -Project C:\Users\defreed\Source\Repos\Test\

Output:
Start-UnityEditor : Could not find Unity.exe under setup instance path:
At line:1 char:1

  • Start-UnityEditor -Project C:\Users\defreed\Source\Repos\Test\
  •   + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
      + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-UnityEditor
    

A DSC Resource for Unity versions

Now that we can detect installs, find installers, and install unity, we can create a DSC resource for ensuring versions of Unity are installed.

Should be able to find all installers for all versions of unity in one call

Right now Find-UnitySetupInstaller requires you to specify a version. It'd be great if I could specify -Latest or neither to find all versions.

  • Should patch and beta versions be included by default if no args are passed?
  • Should we add flags to control the versions you'll search for, use param sets to avoid Version being specified.
  • Should we add a Find-UnitySetupVersion which finds available versions which could be piped to 'Find-UnitySetupInstaller'?

Running Install Script Multiple Times Fails Installing Any

Running a command like Find-UnitySetupInstaller -Version '2017.1.2f1' | Install-UnitySetupInstance and Find-UnitySetupInstaller -Version '2017.1.1p1' | Install-UnitySetupInstance at the same time was causing issues with both versions being unable to install properly.

Both Unity install folders end up looking like Unity projects. Which was quite weird.
capture

Suggested to allow for downloading all the setup files in parallel and / or up front. Lock installation to only a single one at a time.

PS Script Analyzer throws error over ConvertTo-SecureString -AsPlainText

RuleName                            Severity     ScriptName Line  Message
--------                            --------     ---------- ----  -------
PSAvoidUsingConvertToSecureStringWi Error        UnitySetup 1015  File 'UnitySetup.psm1' uses ConvertTo-SecureString with
thPlainText                                      .psm1            plaintext. This will expose secure information. Encrypted
                                                                  standard strings should be used instead.

Builds are actually broken

The builds act like they succeeded, but they have not. Looks like AppVeyor updated it's host machines and now some imports don't work.

I'll try to apply the -AllowClobber flag to see if the imports fix the issue.

Start-Process call format for launching Unity Setup throws error when Set-PSDebug -Trace set to 2

in script do:
Set-PSDebug -Trace 2

Call Install-UnitySetupInstance

Bug - the line $process = Start-Process @startProcessArgs
has issues when Trace set to 2.

Cannot convert value to type System.String.
At C:\Program Files\WindowsPowerShell\Modules\UnitySetup\4.0.97\UnitySetup.psm1:487 char:13

  •         $process = Start-Process @startProcessArgs
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvalidCastFromAnyTypeToString

perhaps consider using:
Start-Process @startPRocessARgs -OutVariable $result | Out-Null

Find-UnitySetupInstaller can't find Unity 2017.1.2p3 Mac component

I'm trying to install the Mac component for Unity 2017.1.2p3. Finding the Mac installer returns nothing, including no error.

PS C:\Users\bryce> Find-UnitySetupInstaller -Version 2017.1.2p3 -Components Mac
PS C:\Users\bryce> Find-UnitySetupInstaller -Version 2017.1.2p3 -Components Setup


ComponentType : Setup
Version       : 2017.1.2p3
Length        : 541722008
LastModified  : 11/21/2017 5:27:22 AM
DownloadUrl   : https://beta.unity3d.com/download/249a06fbaf10/Windows64EditorInstaller/UnitySetup64-2017.1.2p3.exe

I downloaded the component through the Download Assistant and sniffed the component url: http://download.unity3d.com/download_unity/249a06fbaf10/TargetSupportInstaller/UnitySetup-Mac-Support-for-Editor-2017.1.2p3.exe

uninstall while Unity is running appears to succeed, but leaves behind some files

  1. Run the Unity editor
  2. Uninstall the version that you are running (e.g. Get-UnitySetupInstance | Select-UnitySetupInstance -Version 2017.3.1f1 | Uninstall-UnitySetupIns tance)
    result: Command appears to complete successfully, but some of the files in Program Files are left behind.
    expected: It would be nice to detect that the Unity process is running and error out without attempting to uninstall.

Start-UnityEditor fails with unclear error when run with invalid Unity path

You see this error:

Cannot convert the "System.Object[]" value of type "System.Object[]" to type "UnityInstance".
At C:\Users\jowitt\Documents\WindowsPowerShell\Modules\UnitySetup\1.4.29\UnitySetup.psm1:260 char:9
+         $Instance =  Get-UnitySetupInstance | Select-UnitySetupInstan ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : ConvertToFinalInvalidCastException

Could not find Unity Editor for version
At C:\Users\jowitt\Documents\WindowsPowerShell\Modules\UnitySetup\1.4.29\UnitySetup.psm1:270 char:9
+         throw "Could not find Unity Editor for version $version"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find Unity Editor for version :String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find Unity Editor for version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.