Skip to content

Commit e2446f0

Browse files
committed
Fix CoroutineStarter log spam
1 parent 6b34624 commit e2446f0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

BeatSaberMarkupLanguage/GameplaySetup/GameplaySetup.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System;
2-
using System.Collections;
32
using System.Collections.Generic;
43
using System.Linq;
54
using System.Reflection;
5+
using System.Threading.Tasks;
66
using BeatSaberMarkupLanguage.Attributes;
77
using BeatSaberMarkupLanguage.Components;
88
using BeatSaberMarkupLanguage.Util;
@@ -20,9 +20,8 @@ public class GameplaySetup : ZenjectSingleton<GameplaySetup>, TableView.IDataSou
2020
private readonly MainFlowCoordinator mainFlowCoordinator;
2121
private readonly GameplaySetupViewController gameplaySetupViewController;
2222
private readonly HierarchyManager hierarchyManager;
23-
private readonly ICoroutineStarter coroutineStarter;
2423

25-
private Coroutine debounceCoroutine;
24+
private Task debounceTask;
2625

2726
[UIObject("root-object")]
2827
private GameObject rootObject;
@@ -48,12 +47,11 @@ public class GameplaySetup : ZenjectSingleton<GameplaySetup>, TableView.IDataSou
4847
[UIValue("mod-menus")]
4948
private SortedList<GameplaySetupMenu> menus = new(Comparer<GameplaySetupMenu>.Create((a, b) => a.Name.CompareTo(b.Name)));
5049

51-
private GameplaySetup(MainFlowCoordinator mainFlowCoordinator, GameplaySetupViewController gameplaySetupViewController, HierarchyManager hierarchyManager, ICoroutineStarter coroutineStarter)
50+
private GameplaySetup(MainFlowCoordinator mainFlowCoordinator, GameplaySetupViewController gameplaySetupViewController, HierarchyManager hierarchyManager)
5251
{
5352
this.mainFlowCoordinator = mainFlowCoordinator;
5453
this.gameplaySetupViewController = gameplaySetupViewController;
5554
this.hierarchyManager = hierarchyManager;
56-
this.coroutineStarter = coroutineStarter;
5755
}
5856

5957
[UIValue("has-menus")]
@@ -143,14 +141,14 @@ public void Dispose()
143141

144142
private void QueueRefreshView()
145143
{
146-
debounceCoroutine ??= coroutineStarter.StartCoroutine(RefreshViewCoroutine());
144+
debounceTask ??= RefreshViewCoroutine();
147145
}
148146

149-
private IEnumerator RefreshViewCoroutine()
147+
private async Task RefreshViewCoroutine()
150148
{
151-
yield return new WaitForEndOfFrame();
149+
await Task.Yield(); // wait for next frame
152150
RefreshView();
153-
debounceCoroutine = null;
151+
debounceTask = null;
154152
}
155153

156154
private void RefreshView()

0 commit comments

Comments
 (0)