diff --git a/CHANGELOG.md b/CHANGELOG.md index 5242401b..12bb55bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Fixed +- [#461] Selection outlines in scene view do not work reliably when preview system is active - [#459] "Proxy object was destroyed improperly! Resetting pipeline..." error appears frequently - [#460] Preview system fails to recover when the primary proxy is destroyed diff --git a/Editor/PreviewSystem/Rendering/ProxySession.cs b/Editor/PreviewSystem/Rendering/ProxySession.cs index f6b8b6f9..3080ada3 100644 --- a/Editor/PreviewSystem/Rendering/ProxySession.cs +++ b/Editor/PreviewSystem/Rendering/ProxySession.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; +using System.Reflection; using nadena.dev.ndmf.preview.trace; using UnityEditor; using UnityEngine; @@ -28,7 +29,19 @@ internal class ProxySession : IDisposable _active?.ProxyToOriginalObject ?? ImmutableDictionary.Empty; internal ProxyObjectCache _proxyCache = new(); + private static readonly FieldInfo _selectionCacheDirtyField; + static ProxySession() + { + _selectionCacheDirtyField = typeof(SceneView) + .GetField("s_SelectionCacheDirty", BindingFlags.NonPublic | BindingFlags.Static); + } + + private void ClearSelectionCache() + { + _selectionCacheDirtyField.SetValue(null, true); + } + private ImmutableList _filters; public ImmutableList Filters { @@ -104,6 +117,7 @@ public void Dispose() _active?.Dispose(); _active = _next; _next = null; + ClearSelectionCache(); } if (activeIsReady)