Skip to content

Commit

Permalink
fix: scene view selection outline is lost when pipeline rebuilds occur (
Browse files Browse the repository at this point in the history
#461)

Closes: #446
  • Loading branch information
bdunderscore authored Oct 20, 2024
1 parent fdb96a6 commit ed08f3d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions Editor/PreviewSystem/Rendering/ProxySession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,7 +29,19 @@ internal class ProxySession : IDisposable
_active?.ProxyToOriginalObject ?? ImmutableDictionary<GameObject, GameObject>.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<IRenderFilter> _filters;
public ImmutableList<IRenderFilter> Filters
{
Expand Down Expand Up @@ -104,6 +117,7 @@ public void Dispose()
_active?.Dispose();
_active = _next;
_next = null;
ClearSelectionCache();
}

if (activeIsReady)
Expand Down

0 comments on commit ed08f3d

Please sign in to comment.