UnityAsync
UnityAsync copied to clipboard
AsyncOperation await issue
when running the following code
List<DisplayInfo> displays = new List<DisplayInfo>();
Screen.GetDisplayLayout(displays);
DisplayInfo display = displays[1];
await Screen.MoveMainWindowTo(display, new Vector2Int(display.width / 2, display.height / 2));
Debug.Log("Finished");
The operation completes however the await call never continues on to call the Debug.Log. I have no clue why it is getting stuck but this may be a problem with MoveMainWindow method itself, I just wanted to share a bug I encountered.
its odd because if I set it up like this
AsyncOperation op = Screen.MoveMainWindowTo(display, new Vector2Int(display.width / 2, display.height / 2));
await Await.Until(() => op.isDone);
It works