diff --git a/CHANGELOG-PRERELEASE.md b/CHANGELOG-PRERELEASE.md index 57a3c3681..ab981f9da 100644 --- a/CHANGELOG-PRERELEASE.md +++ b/CHANGELOG-PRERELEASE.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog]. ### Added ### Changed +- Improve ErrorReport window on build error `#216` ### Deprecated diff --git a/CHANGELOG.md b/CHANGELOG.md index 326d42032..1b3330816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog]. ### Added ### Changed +- Improve ErrorReport window on build error `#216` ### Deprecated diff --git a/Internal/ErrorReporter/Editor/BuildReport.cs b/Internal/ErrorReporter/Editor/BuildReport.cs index 19763a8c0..7c61f31e6 100644 --- a/Internal/ErrorReporter/Editor/BuildReport.cs +++ b/Internal/ErrorReporter/Editor/BuildReport.cs @@ -83,10 +83,14 @@ private class AvatarReportScope : IDisposable { public void Dispose() { - var successful = CurrentReport.CurrentAvatar.successful; + var avatar = CurrentReport.CurrentAvatar; CurrentReport.CurrentAvatar = null; + var successful = avatar.successful; BuildReport.SaveReport(); - ErrorReportUI.MaybeOpenErrorReportUI(); + if (avatar.logs.Any()) + ErrorReportUI.OpenErrorReportUIFor(avatar); + else + ErrorReportUI.MaybeOpenErrorReportUI(); if (!successful) throw new Exception("Avatar processing failed"); } } diff --git a/Internal/ErrorReporter/Editor/ErrorReportUI.cs b/Internal/ErrorReporter/Editor/ErrorReportUI.cs index a177d7abe..dba7d0c72 100644 --- a/Internal/ErrorReporter/Editor/ErrorReportUI.cs +++ b/Internal/ErrorReporter/Editor/ErrorReportUI.cs @@ -1,9 +1,10 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; +using JetBrains.Annotations; using UnityEditor; +using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; @@ -19,6 +20,13 @@ public static void OpenErrorReportUI() GetWindow().Show(); } + public static void OpenErrorReportUIFor(AvatarReport avatar) + { + var window = GetWindow(); + window.Show(); + window._header.Value = avatar; + } + public static void MaybeOpenErrorReportUI() { if (BuildReport.CurrentReport.avatars.Any(av => av.logs.Count > 0)) @@ -27,18 +35,11 @@ public static void MaybeOpenErrorReportUI() } } - private Vector2 _avatarScrollPos, _errorScrollPos; - private int _selectedAvatar = -1; - private List