Skip to content

UnityProjectInstance fixed for older Unity versions #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 3, 2020

Conversation

derekfreed
Copy link
Member

  • Fixed terminating exception when making a UnityProjectInstance from older versions of Unity

Versions such as 5.6.0f3 do not have projectsettings.asset files that can be read in the same way as newer versions of Unity.

@microsoft microsoft deleted a comment from derekfreed Aug 3, 2020
Write-Warning -Message "Exception Message: $($_.Exception.Message)"
}
finally{
$prodName = ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by doing this in finally, $prodName will always end up as the empty string. I'd move this line up into the end of the catch block and probably set it to $null instead of the empty string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks :)

@derekfreed derekfreed requested a review from timGerken August 3, 2020 16:55
Copy link
Member

@jwittner jwittner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of ideas for improvements. =)

if (!$prodName) { throw "ProjectSettings is missing productName" }
}
catch {
Write-Warning -Message "An Exception was caught!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's reasonable to print the exception, but since we know the issue you're seeing will be common, we should point that out with a message something akin to, "Could not read $projectSettingsFile, have you set your meta files to "Force Text"".

catch {
Write-Warning -Message "An Exception was caught!"
Write-Warning -Message "Exception Type: $($_.Exception.GetType().FullName)"
Write-Warning -Message "Exception Message: $($_.Exception.Message)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use newlines to log these warnings? Otherwise they'll show up at three warnings when actually there's one.

@jwittner jwittner merged commit 2ea10b8 into microsoft:develop Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants