mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-09 10:58:57 +08:00
Make sure WaitForEndOfFrame object is never null
This commit is contained in:
parent
211576e0f8
commit
0274022ce4
@ -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()
|
private static IEnumerator AggressiveUnlockCoroutine()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
yield return _waitForEndOfFrame;
|
yield return _waitForEndOfFrame ?? (_waitForEndOfFrame = new WaitForEndOfFrame());
|
||||||
|
|
||||||
if (UIManager.ShowMenu)
|
if (UIManager.ShowMenu)
|
||||||
UpdateCursorControl();
|
UpdateCursorControl();
|
||||||
|
@ -193,13 +193,12 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
RuntimeProvider.Instance.StartCoroutine(InitCoroutine(onHeightChangedListener));
|
RuntimeProvider.Instance.StartCoroutine(InitCoroutine(onHeightChangedListener));
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
|
private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
|
||||||
|
|
||||||
private IEnumerator InitCoroutine(Action onHeightChangedListener)
|
private IEnumerator InitCoroutine(Action onHeightChangedListener)
|
||||||
{
|
{
|
||||||
ScrollRect.content.anchoredPosition = Vector2.zero;
|
ScrollRect.content.anchoredPosition = Vector2.zero;
|
||||||
//yield return null;
|
yield return waitForEndOfFrame ?? (waitForEndOfFrame = new WaitForEndOfFrame());
|
||||||
yield return waitForEndOfFrame;
|
|
||||||
|
|
||||||
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user