Skip to content

Commit d680cef

Browse files
authored
Merge pull request #67 from jwittner/dev/detectInstalledComponents
Support for Components on UnitySetupInstance
2 parents 9eb75f2 + bfe10b2 commit d680cef

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ Find all of your Unity installs:
2727
Get-UnitySetupInstance
2828
2929
# Example output:
30-
# InstallationVersion InstallationPath
31-
# ------------------- ----------------
32-
# 2017.2.1f1 C:\Program Files\Unity-2017.2.1f1\Editor\
33-
# 2017.1.0p5 C:\Program Files\Unity.2017.1.0p5\Editor\
34-
# 2017.1.1f1 C:\Program Files\Unity.2017.1.1f1\Editor\
35-
# 2017.1.1p3 C:\Program Files\Unity.2017.1.1p3\Editor\
36-
# 2017.2.0f3 C:\Program Files\Unity.2017.2.0f3\Editor\
37-
# 2017.3.0f3 C:\Program Files\Unity.2017.3.0f3\Editor\
38-
# 5.5.4p3 C:\Program Files (x86)\Unity.5.5.4p3\Editor\
30+
# Version Components Path
31+
# ------- ---------- ----
32+
# 2017.1.2f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.1.2f1\Editor\
33+
# 2017.1.3f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.1.3f1\Editor\
34+
# 2017.2.1f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.2.1f1\Editor\
35+
# 2017.3.1f1 Setup, Metro, UWP_IL2CPP, Linux, Vuforia C:\Program Files\Unity-2017.3.1f1\Editor\
36+
# 2018.1.0b4 Setup, Metro, UWP_IL2CPP, Vuforia C:\Program Files\Unity-2018.1.0b4\Editor\
37+
# 2018.1.0b8 All C:\Program Files\Unity-2018.1.0b8\Editor\
38+
# 2017.1.0p5 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.0p5\Editor\
39+
# 2017.1.1f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.1f1\Editor\
40+
# 2017.1.1p3 Setup, StandardAssets, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.1p3\Editor\
41+
# 2017.2.0f3 Setup, Metro, UWP_IL2CPP, Vuforia C:\Program Files\Unity.2017.2.0f3\Editor\
42+
# 2017.3.0f3 Setup, Metro, UWP_IL2CPP, Mac, Vuforia C:\Program Files\Unity.2017.3.0f3\Editor\
3943
```
4044

4145
Select the Unity installs that you want:
@@ -50,12 +54,12 @@ Find all the Unity projects recursively:
5054
Get-UnityProjectInstance -Recurse
5155
5256
# Example output:
53-
# ProjectPath UnityInstanceVersion
54-
# ----------- --------------------
55-
# C:\Projects\Project1\OneUnity\ 2017.2.0f3
56-
# C:\Projects\Project1\TwoUnity\ 2017.3.0f3
57-
# C:\Projects\Project2\ 2017.1.1p1
58-
# C:\Projects\Project3\App.Unity\ 2017.1.2f1
57+
# Version Path
58+
# ------- ----
59+
# 2017.2.0f3 C:\Projects\Project1\OneUnity\
60+
# 2017.3.0f3 C:\Projects\Project1\TwoUnity\
61+
# 2017.1.1p1 C:\Projects\Project2\
62+
# 2017.1.2f1 C:\Projects\Project3\App.Unity\
5963
```
6064
Launch the right Unity editor for a project:
6165
```powershell

UnitySetup/UnitySetup.psm1

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ enum UnitySetupComponentType
1919
Mac = (1 -shl 11)
2020
Vuforia = (1 -shl 12)
2121
WebGL = (1 -shl 13)
22-
All = (-1)
22+
All = (1 -shl 14) - 1
2323
}
2424

2525
class UnitySetupInstaller
@@ -34,8 +34,9 @@ class UnitySetupInstaller
3434
class UnitySetupInstance
3535
{
3636
[UnityVersion]$Version
37+
[UnitySetupComponentType]$Components
3738
[string]$Path
38-
39+
3940
UnitySetupInstance([string]$path) {
4041

4142
$ivyPath = [io.path]::Combine("$path", 'Data\UnityExtensions\Unity\Networking\ivy.xml');
@@ -44,10 +45,37 @@ class UnitySetupInstance
4445

4546
if( !($xmlDoc.'ivy-module'.info.unityVersion)) {
4647
throw "Unity setup ivy is missing version: $ivyPath"
47-
}
48+
}
4849

4950
$this.Path = $path
5051
$this.Version = $xmlDoc.'ivy-module'.info.unityVersion
52+
$this.Components = [UnitySetupComponentType]::Setup
53+
54+
$componentTests = @{
55+
[UnitySetupComponentType]::Documentation = ,"$Path\Data\Documentation";
56+
[UnitySetupComponentType]::StandardAssets = ,"$Path\Standard Assets";
57+
[UnitySetupComponentType]::Windows_IL2CPP = ,"$Path\Data\PlaybackEngines\windowsstandalonesupport\Variations\win32_development_il2cpp";
58+
[UnitySetupComponentType]::Metro = "$Path\Data\PlaybackEngines\MetroSupport\Templates\UWP_.NET_D3D",
59+
"$Path\Data\PlaybackEngines\MetroSupport\Templates\UWP_D3D";
60+
[UnitySetupComponentType]::UWP_IL2CPP = ,"$Path\Data\PlaybackEngines\MetroSupport\Templates\UWP_IL2CPP_D3D";
61+
[UnitySetupComponentType]::Android = ,"$Path\Data\PlaybackEngines\AndroidPlayer";
62+
[UnitySetupComponentType]::iOS = , "$Path\Data\PlaybackEngines\iOSSupport";
63+
[UnitySetupComponentType]::AppleTV = , "$Path\Data\PlaybackEngines\AppleTVSupport";
64+
[UnitySetupComponentType]::Facebook = , "$Path\Data\PlaybackEngines\Facebook";
65+
[UnitySetupComponentType]::Linux = , "$Path\Data\PlaybackEngines\LinuxStandaloneSupport";
66+
[UnitySetupComponentType]::Mac = , "$Path\Data\PlaybackEngines\MacStandaloneSupport";
67+
[UnitySetupComponentType]::Vuforia = , "$Path\Data\PlaybackEngines\VuforiaSupport";
68+
[UnitySetupComponentType]::WebGL = , "$Path\Data\PlaybackEngines\WebGLSupport";
69+
}
70+
71+
$componentTests.Keys | ForEach-Object {
72+
foreach( $test in $componentTests[$_] ) {
73+
if( Test-Path -PathType Container -Path $test ) {
74+
$this.Components += $_
75+
break;
76+
}
77+
}
78+
}
5179
}
5280
}
5381

0 commit comments

Comments
 (0)