diff --git a/src/Core/Input/CursorUnlocker.cs b/src/Core/Input/CursorUnlocker.cs index f4fa575..3f823b9 100644 --- a/src/Core/Input/CursorUnlocker.cs +++ b/src/Core/Input/CursorUnlocker.cs @@ -62,13 +62,13 @@ namespace UnityExplorer.Core.Input } } - private static readonly WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame(); + private static WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame(); private static IEnumerator AggressiveUnlockCoroutine() { while (true) { - yield return _waitForEndOfFrame; + yield return _waitForEndOfFrame ?? (_waitForEndOfFrame = new WaitForEndOfFrame()); if (UIManager.ShowMenu) UpdateCursorControl(); diff --git a/src/UI/Widgets/ScrollPool/ScrollPool.cs b/src/UI/Widgets/ScrollPool/ScrollPool.cs index e9db77c..769e2ef 100644 --- a/src/UI/Widgets/ScrollPool/ScrollPool.cs +++ b/src/UI/Widgets/ScrollPool/ScrollPool.cs @@ -193,13 +193,12 @@ namespace UnityExplorer.UI.Widgets RuntimeProvider.Instance.StartCoroutine(InitCoroutine(onHeightChangedListener)); } - private readonly WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame(); + private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame(); private IEnumerator InitCoroutine(Action onHeightChangedListener) { ScrollRect.content.anchoredPosition = Vector2.zero; - //yield return null; - yield return waitForEndOfFrame; + yield return waitForEndOfFrame ?? (waitForEndOfFrame = new WaitForEndOfFrame()); LayoutRebuilder.ForceRebuildLayoutImmediate(Content);