[QUALITY] Coroutines started without references — can't be stopped on destroy/disable #21

Open
opened 2026-03-12 00:03:38 +00:00 by lavarius · 0 comments
Owner

🟡 Medium — Code Quality

Coroutines are started but references are never stored, making it impossible to stop them properly:

  • Radio.cs: MonitorStream() runs indefinitely, never stopped on disable/destroy
  • CharacterStore.cs: Multiple StartCoroutine(DisableRagdolCoor) calls without tracking
  • CallElevator.cs: Coroutines started without reference storage

Fix: Store coroutine references and stop them in OnDestroy/OnDisable:

private Coroutine _monitorCoroutine;

void OnEnable() => _monitorCoroutine = StartCoroutine(MonitorStream());
void OnDisable() { if (_monitorCoroutine != null) StopCoroutine(_monitorCoroutine); }
## 🟡 Medium — Code Quality Coroutines are started but references are never stored, making it impossible to stop them properly: - `Radio.cs`: `MonitorStream()` runs indefinitely, never stopped on disable/destroy - `CharacterStore.cs`: Multiple `StartCoroutine(DisableRagdolCoor)` calls without tracking - `CallElevator.cs`: Coroutines started without reference storage **Fix:** Store coroutine references and stop them in `OnDestroy`/`OnDisable`: ```csharp private Coroutine _monitorCoroutine; void OnEnable() => _monitorCoroutine = StartCoroutine(MonitorStream()); void OnDisable() { if (_monitorCoroutine != null) StopCoroutine(_monitorCoroutine); } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lavarius/ProjectOverlay#21
No description provided.