Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4
2019.4.6f1
2020.1
2020.2
Issue ID
1271977
Regression
No
[UnityWebRequest] Playfab async Task doesn't let the UnityWebRequest task to finish
Reproduction steps:
1. Open the attached project ("1271977Repro.zip")
2. Open "SampleScene" scene
3. Enter Play mode
Expected result: Multiple UnityWebRequests are called (one to Playfab and Postman)
Actual result: The postman call never comes back from “await”
Reproducible with: 2018.4.26f1, 2019.4.9f1, 2020.1.4f1, 2020.2.0a21
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
Resolution Note:
The issue happens because users implementation for awaiter is buggy.
Users code relies on completed event of the AsyncOperation returned by UnityWebRequest. That event is fired when operation completes, however, you have to connect a handler to it before operation completes.
In users code two operations are fired and then awaited, so UWR operation completes before it is awaited due to playfabTask taking longer. If playfab task is removed, UWR task can be awaited.
Change UnityAsyncOperationAwaiter constructor as below fixes the issue for me (note, that Editor gets stuck in a loop after this change, since there is no exit from it).
public UnityAsyncOperationAwaiter(IAsyncOperation operation)
{
if (operation.IsDone)
{
IsCompleted = true;
_continuation?.Invoke();
}
else
operation.Completed += OnOperationCompleted;
}