Skip to content

Commit d05a058

Browse files
committed
fix: minor bug that caused quick settings panel to remain visible even after all probes were destroyed
1 parent c1be0c8 commit d05a058

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

Assets/Scripts/TrajectoryPlanner/TP_ProbeQuickSettings.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,17 @@ public void UpdateCoordinates()
9696

9797
public void UpdateQuickUI()
9898
{
99-
_probeIdText.text = ProbeManager.ActiveProbeManager.name;
100-
_probeIdText.color = ProbeManager.ActiveProbeManager.Color;
101-
SetColorChooserColor(ProbeManager.ActiveProbeManager.Color);
99+
if (ProbeManager.ActiveProbeManager != null)
100+
{
101+
_probeIdText.text = ProbeManager.ActiveProbeManager.name;
102+
_probeIdText.color = ProbeManager.ActiveProbeManager.Color;
103+
SetColorChooserColor(ProbeManager.ActiveProbeManager.Color);
104+
}
105+
else
106+
{
107+
_probeIdText.text = "";
108+
UpdateInteractable(true);
109+
}
102110
}
103111

104112
/// <summary>

Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public void DestroyProbe(ProbeManager probeManager)
346346
Destroy(probeManager.gameObject);
347347

348348
// Cleanup UI if this was last probe in scene
349-
var realProbes = ProbeManager.Instances.Where(x => x.ProbeType != ProbeProperties.ProbeType.Placeholder);
349+
var realProbes = ProbeManager.Instances.Where(x => x.ProbeType != ProbeProperties.ProbeType.Placeholder && x != probeManager);
350350

351351
if (realProbes.Count() > 0)
352352
{
@@ -366,6 +366,7 @@ public void DestroyProbe(ProbeManager probeManager)
366366
_probeQuickSettings.UpdateInteractable(true);
367367
SetSurfaceDebugActive(false);
368368
UpdateQuickSettings();
369+
UpdateQuickSettingsProbeIdText();
369370
}
370371

371372
_probeAddedOrRemovedEvent.Invoke();

0 commit comments

Comments
 (0)