Skip to content

Commit

Permalink
fix: minor bugs in preview system (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore authored Jul 2, 2024
1 parent d8cb15a commit fc28310
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Editor/ChangeStream/ListenerSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ internal void MaybeFire(T info)
else if (_filter(info))
{
ctx.Invalidate();
EditorApplication.delayCall += SceneView.RepaintAll;
// We need to wait two frames before repainting: One to process task callbacks, then one to actually
// repaint (and update previews).
EditorApplication.delayCall += Delay2Repaint;
Dispose();
}
}

private void Delay2Repaint()
{
EditorApplication.delayCall += SceneView.RepaintAll;
}
}

internal class ListenerSet<T>
Expand Down
2 changes: 2 additions & 0 deletions Editor/ChangeStream/ObjectWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ public R MonitorObjectProps<T, R>(T obj, ComputeContext ctx, Func<T, R> extract,

if (usePropMonitor)
{
if (obj is Component c && c.gameObject.hideFlags != 0) return curVal;

var propsListeners = PropertyMonitor.MonitorObjectProps(obj);
propsListeners.Register(_ => obj == null || !compare(curVal, extract(obj)), ctx);

Expand Down

0 comments on commit fc28310

Please sign in to comment.