Skip to content

Commit

Permalink
fix: Picking status is not synchronized
Browse files Browse the repository at this point in the history
  • Loading branch information
Rerigferl committed Oct 6, 2024
1 parent d548ef5 commit 1bce1b3
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Editor/PreviewSystem/Rendering/ProxyObjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,25 @@ internal bool OnPreFrame()
{
_pickingOffOriginal = SceneVisibilityManager.instance.IsPickingDisabled(original.gameObject);
_visibilityOffOriginal = SceneVisibilityManager.instance.IsHidden(original.gameObject);
}

target.enabled = false;

bool shouldDisablePicking = _pickingOffOriginal || _visibilityOffOriginal;

if (shouldDisablePicking != _pickingOffReplacement)
{
if (shouldDisablePicking)
{
SceneVisibilityManager.instance.DisablePicking(target.gameObject, false);
}
else
var pickingOffTarget = SceneVisibilityManager.instance.IsPickingDisabled(target.gameObject);
if (_pickingOffOriginal != pickingOffTarget)
{
SceneVisibilityManager.instance.EnablePicking(target.gameObject, false);
if (_pickingOffOriginal)
{
SceneVisibilityManager.instance.DisablePicking(target.gameObject, false);
}
else
{
SceneVisibilityManager.instance.EnablePicking(target.gameObject, false);
}
}

_lastVisibilityCheck = VisibilityMonitor.Sequence;
}

target.enabled = false;

SkinnedMeshRenderer smr = null;
if (_originalRenderer is SkinnedMeshRenderer smr_)
{
Expand Down

0 comments on commit 1bce1b3

Please sign in to comment.