In our Unity project, I am trying to make a PlayFab API call in order to save player's progress data to the cloud when our game suspends. To do this, I subscribe to the
UnityEngine.GameCore.GameCorePLM.OnSuspendingEvent event and, in the handler for that, I make the PlayFab API call to save the data.
Once we get a response from the API, or if we go beyond 500ms (hopefully keeping us well within the 1000ms time limit for suspension) we call
UnityEngine.GameCore.GameCorePLM.AmReadyToSuspendNow in order to continue with the suspension.
From logs and breakpoints I can see that the PlayFAB SDK gets to the point where it calls
yield return www.SendWebRequest(); (we are using the "Unity Web Request" Request Type, which I believe is the recommended type). However we never get further than this. I have verified in Fiddler that the API call is never made.
As we never get a response, our 500ms time limit is always hitting and we are never saving the players progress data.
The PlayFab code relies on coroutines which is attracting some suspicion from me.
What is the correct way to make a PlayFab API call when suspending?
GDK Version GDK October 2022: Version 10.0.22621.1852