Skip to content

Commit d5d5ce1

Browse files
committed
Fixed terminating exception when making a UnityProjectInstance from older versions of Unity
1 parent 75fc290 commit d5d5ce1

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

UnitySetup/UnitySetup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
RootModule = 'UnitySetup'
1515

1616
# Version number of this module.
17-
ModuleVersion = '5.3'
17+
ModuleVersion = '5.4'
1818

1919
# Supported PSEditions
2020
# CompatiblePSEditions = @()

UnitySetup/UnitySetup.psm1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,18 @@ class UnityProjectInstance {
125125
$projectSettingsFile = [io.path]::Combine($path, "ProjectSettings\ProjectSettings.asset")
126126
if (!(Test-Path $projectSettingsFile)) { throw "Project is missing ProjectSettings.asset" }
127127

128-
$prodName = ((Get-Content $projectSettingsFile -Raw | ConvertFrom-Yaml)['playerSettings'])['productName']
129-
if (!$prodName) { throw "ProjectSettings is missing productName" }
128+
try {
129+
$prodName = ((Get-Content $projectSettingsFile -Raw | ConvertFrom-Yaml)['playerSettings'])['productName']
130+
if (!$prodName) { throw "ProjectSettings is missing productName" }
131+
}
132+
catch {
133+
Write-Warning -Message "An Exception was caught!"
134+
Write-Warning -Message "Exception Type: $($_.Exception.GetType().FullName)"
135+
Write-Warning -Message "Exception Message: $($_.Exception.Message)"
136+
}
137+
finally{
138+
$prodName = ""
139+
}
130140

131141
$this.Path = $path
132142
$this.Version = $fileVersion

0 commit comments

Comments
 (0)