Kind of fixed weird issue with Task not stopping on application Quit

This commit is contained in:
Thorbjoern
2025-07-22 01:15:09 +02:00
parent 440820f65a
commit 7b99f58a27
2 changed files with 20 additions and 1 deletions
@@ -43,6 +43,7 @@ namespace GhostSystem
private float totalDuration = 0f;
private string firstTimestamp = "";
private string lastTimestamp = "";
private bool awaitingFrames;
private Dictionary<string, List<FrameModel>> objectTracks = new();
@@ -108,6 +109,7 @@ namespace GhostSystem
if (!supabaseReady || !sceneIdReady) return;
sceneId = loadedSceneId;
awaitingFrames = true;
await LoadAllFrames();
loadingScreen.SetActive(false);
@@ -193,7 +195,7 @@ namespace GhostSystem
private async UniTaskVoid PeriodicUpdateFrames() // lädt alle 10 s neue Frames nach, falls verfügbar
{
while (true)
while (awaitingFrames)
{
await UniTask.Delay(TimeSpan.FromSeconds(10));
await LoadNewFramesAfter(latestLoadedTimestamp);
@@ -347,6 +349,11 @@ namespace GhostSystem
TrackedObjects.RemoveRange(TrackedObjects.Count - doorCount, doorCount);
doorCount = 0;
}
public void StopAwaitingFrames()
{
awaitingFrames = false;
}
}
}