Skip to content

Commit 73a40ed

Browse files
authored
fix: minor fixes to error report UI (#237)
Closes: #232
1 parent 960805b commit 73a40ed

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Fixed
1616
- Workaround VRCSDK bug where stale PhysBones state could be retained over play mode transitions (#231)
1717
- Show object name when we're unable to find the actual GameObject, in error display UI (#224)
18+
- Rerender error report window when leaving play mode (#237)
19+
- Deduplicate object references in NDMF console error reports (#237)
1820

1921
### Changed
2022
- Renamed `NDMF Error Report` to `NDMF Console` (#222)

Editor/ErrorReporting/UI/ErrorReportWindow.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
#region
22

3-
using System;
43
using System.Collections.Generic;
54
using System.Linq;
65
using nadena.dev.ndmf.localization;
76
using nadena.dev.ndmf.runtime;
87
using UnityEditor;
98
using UnityEditor.UIElements;
109
using UnityEngine;
11-
using UnityEngine.SceneManagement;
1210
using UnityEngine.UIElements;
13-
using Object = UnityEngine.Object;
1411

1512
#endregion
1613

1714
namespace nadena.dev.ndmf.ui
1815
{
1916
#region
2017

21-
using UnityObject = Object;
22-
2318
#endregion
2419

2520
// Note: Due to historical reason, "NDMF Console" is internally called "Error Report".
@@ -147,11 +142,23 @@ private void OnEnable()
147142
// GUI setup done
148143
EditorApplication.hierarchyChanged += SetupSelector;
149144
}
145+
146+
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
150147
}
151148

152149
private void OnDisable()
153150
{
154151
EditorApplication.hierarchyChanged -= SetupSelector;
152+
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
153+
}
154+
155+
private void OnPlayModeStateChanged(PlayModeStateChange state)
156+
{
157+
if (_testBuild != null && state == PlayModeStateChange.EnteredEditMode)
158+
{
159+
// Rerender error UI in case we can now find objects that had moved during processing...
160+
UpdateContents();
161+
}
155162
}
156163

157164
private void OnSelectionChange()

Editor/ErrorReporting/UI/SimpleErrorUI.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#region
22

3+
using System.Collections.Generic;
34
using nadena.dev.ndmf.localization;
45
using UnityEditor;
56
using UnityEngine.UIElements;
@@ -88,8 +89,12 @@ private void RenderContent()
8889
}
8990
else
9091
{
92+
HashSet<ObjectReference> _refs = new HashSet<ObjectReference>();
9193
foreach (var objRef in _error.References)
9294
{
95+
// dedup refs
96+
if (!_refs.Add(objRef)) continue;
97+
9398
if (ObjectSelector.TryCreate(_report, objRef, out var selector))
9499
{
95100
objRefs.Add(selector);

0 commit comments

Comments
 (0)