diff --git a/ml/MetricsOverlay.py b/ml/MetricsOverlay.py index 31afc47..73263dc 100644 --- a/ml/MetricsOverlay.py +++ b/ml/MetricsOverlay.py @@ -97,7 +97,12 @@ class MetricsHUD: ) def reset(self) -> None: - """Clears text reference on environment reset.""" + """Removes the active debug text item so a new episode starts with a clean overlay.""" + if self._text_id is not None: + try: + p.removeUserDebugItem(self._text_id, physicsClientId=self.client_id) + except Exception: + pass self._text_id = None @@ -134,4 +139,9 @@ class LeaderCrown: ) def reset(self): + if self._text_id is not None: + try: + p.removeUserDebugItem(self._text_id, physicsClientId=self.client_id) + except Exception: + pass self._text_id = None \ No newline at end of file