In client(Unity), I am calling an Atlas function to create a player’s document. However, the Unity client is not able to retrieve the newly created document immediately after the Atlas function finishes writing it. I have tried using WaitForDownloadAsync
to ensure that the download is complete, but it doesn’t seem to be working. Here is the code snippet for my Atlas function
This is my atlas function
public static async Task<Dictionary<string, object>> CallAtlasFunc(AtlasFunc _func, bool _waitSync, Dictionary<string, object> _data) {
string jsonResult = null;
if (_data == null) jsonResult = await MyApp.CurrentUser.Functions.CallAsync<string>(_func.ToString());
else jsonResult = await MyApp.CurrentUser.Functions.CallAsync<string>(_func.ToString(), _data);
try {
//WriteLog.LogColorFormat("jsonResult: {0}", WriteLog.LogType.Realm, jsonResult);
var dataDic = HandleReplyData(jsonResult);
if (_waitSync) await MyRealm.SyncSession.WaitForDownloadAsync(); //<----- I use WaitForDownloadAsync to make sure downalod finished but it's not working.
//dataDic.Log();
return dataDic;
} catch (Exception _e) {
WriteLog.LogError("CallAtlasFunc Error: " + _e);
return null;
}
}
I use WaitForDownloadAsync to make sure downalod finished but it’s not working.
So I can’t make sure I got the newest player data.
var player = MyRealm.Find(MyApp.CurrentUser.Id);// <–player’s data may be old