Expose productName in UnityProjectInstance
This commit is contained in:
Родитель
fa131b7a17
Коммит
2febb70772
12
README.md
12
README.md
|
@ -55,12 +55,12 @@ 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\
|
||||
# Version Path ProductName
|
||||
# ------- ---- -----------
|
||||
# 2017.2.0f3 C:\Projects\Project1\OneUnity\ Contoso
|
||||
# 2017.3.0f3 C:\Projects\Project1\TwoUnity\ Northwind
|
||||
# 2017.1.1p1 C:\Projects\Project2\ My Cool App
|
||||
# 2017.1.2f1 C:\Projects\Project3\App.Unity\ TemplateProject
|
||||
```
|
||||
Launch the right Unity editor for a project:
|
||||
```powershell
|
||||
|
|
|
@ -122,6 +122,7 @@ class UnitySetupInstance {
|
|||
class UnityProjectInstance {
|
||||
[UnityVersion]$Version
|
||||
[string]$Path
|
||||
[string]$ProductName
|
||||
|
||||
UnityProjectInstance([string]$path) {
|
||||
$versionFile = [io.path]::Combine($path, "ProjectSettings\ProjectVersion.txt")
|
||||
|
@ -130,8 +131,15 @@ class UnityProjectInstance {
|
|||
$fileVersion = (Get-Content $versionFile -Raw | ConvertFrom-Yaml)['m_EditorVersion'];
|
||||
if (!$fileVersion) { throw "Project is missing a version in: $versionFile"}
|
||||
|
||||
$projectSettingsFile = [io.path]::Combine($path, "ProjectSettings\ProjectSettings.asset")
|
||||
if (!(Test-Path $projectSettingsFile)) { throw "Project is missing ProjectSettings.asset"}
|
||||
|
||||
$prodName = ((Get-Content $projectSettingsFile -Raw | ConvertFrom-Yaml)['playerSettings'])['productName']
|
||||
if (!$prodName) { throw "ProjectSettings is missing productName"}
|
||||
|
||||
$this.Path = $path
|
||||
$this.Version = $fileVersion
|
||||
$this.ProductName = $prodName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче