From 4b17f142d8d42536bc6e0d4333124ecc6ba16daf Mon Sep 17 00:00:00 2001 From: bd_ Date: Fri, 24 Jan 2025 18:29:21 -0800 Subject: [PATCH] fix: partial fix for test build button becoming disabled after test build (#518) This fixes an issue where the "test build" button would become disabled after testing an avatar which is not at the root of the scene. Note that the underlying issue (#493) remains outstanding for now, but this workaround should deal with the immediate bug report. Closes: #493 --- CHANGELOG.md | 1 + Editor/ErrorReporting/UI/ErrorReportWindow.cs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33a73b01..6f1a97d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Performance improvements (#515 #516) +- "Test build" button is disabled after test-building an avatar that is not a scene root (#518) ### Changed diff --git a/Editor/ErrorReporting/UI/ErrorReportWindow.cs b/Editor/ErrorReporting/UI/ErrorReportWindow.cs index 18121993..63b235df 100644 --- a/Editor/ErrorReporting/UI/ErrorReportWindow.cs +++ b/Editor/ErrorReporting/UI/ErrorReportWindow.cs @@ -227,6 +227,7 @@ private void TestBuild() { if (_avatarRoot == null) return; + var currentAvatar = _avatarRoot; var clone = Instantiate(_avatarRoot); try @@ -236,6 +237,16 @@ private void TestBuild() AvatarProcessor.ProcessAvatar(clone); CurrentReport = ErrorReport.Reports.FirstOrDefault(); + + // HACK: If the avatar is not at the root of the scene, we end up being unable to find it (because the + // clone is at the root). For now, we force reset the avatar root here, but we should find a more + // reliable way to find the original avatar. This probably needs to be plugged into the platform API + // system, so for now we'll do this workaround to ensure that the test build button remains enabled. + // See https://github.com/bdunderscore/ndmf/issues/517 + + // Note: We avoid the property accessor as it would clear the CurrentReport property. + _avatarRoot = currentAvatar; + UpdateContents(); } finally {