File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,12 @@ Find all the Unity projects recursively:
55
55
Get-UnityProjectInstance -Recurse
56
56
57
57
# Example output:
58
- # Version Path
59
- # ------- ----
60
- # 2017.2.0f3 C:\Projects\Project1\OneUnity\
61
- # 2017.3.0f3 C:\Projects\Project1\TwoUnity\
62
- # 2017.1.1p1 C:\Projects\Project2\
63
- # 2017.1.2f1 C:\Projects\Project3\App.Unity\
58
+ # Version Path ProductName
59
+ # ------- ---- -----------
60
+ # 2017.2.0f3 C:\Projects\Project1\OneUnity\ Contoso
61
+ # 2017.3.0f3 C:\Projects\Project1\TwoUnity\ Northwind
62
+ # 2017.1.1p1 C:\Projects\Project2\ My Cool App
63
+ # 2017.1.2f1 C:\Projects\Project3\App.Unity\ TemplateProject
64
64
```
65
65
Launch the right Unity editor for a project:
66
66
``` powershell
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ class UnitySetupInstance {
122
122
class UnityProjectInstance {
123
123
[UnityVersion ]$Version
124
124
[string ]$Path
125
+ [string ]$ProductName
125
126
126
127
UnityProjectInstance([string ]$path ) {
127
128
$versionFile = [io.path ]::Combine($path , " ProjectSettings\ProjectVersion.txt" )
@@ -130,8 +131,15 @@ class UnityProjectInstance {
130
131
$fileVersion = (Get-Content $versionFile - Raw | ConvertFrom-Yaml )[' m_EditorVersion' ];
131
132
if (! $fileVersion ) { throw " Project is missing a version in: $versionFile " }
132
133
134
+ $projectSettingsFile = [io.path ]::Combine($path , " ProjectSettings\ProjectSettings.asset" )
135
+ if (! (Test-Path $projectSettingsFile )) { throw " Project is missing ProjectSettings.asset" }
136
+
137
+ $prodName = ((Get-Content $projectSettingsFile - Raw | ConvertFrom-Yaml )[' playerSettings' ])[' productName' ]
138
+ if (! $prodName ) { throw " ProjectSettings is missing productName" }
139
+
133
140
$this.Path = $path
134
141
$this.Version = $fileVersion
142
+ $this.ProductName = $prodName
135
143
}
136
144
}
137
145
You can’t perform that action at this time.
0 commit comments