Hello guys, I'm having a lot of trouble understanding how I get data from the database that PlayFab offers when I'm using Unity.
The problem here is that the Debug.Log() shows the correct data, but it doesn't show in the textview. It seems to be that the method is asynchrous, but I really can't wrap my head around it. I have been stuck on this for some time and have searched and found a lot of info but I just can't seem to implement it. Could some of you guys help me get started?
Thanks in advance
//The following method is for getting the PlayFabId of the current user public static string GetPlayFabId() { PlayFabSettings.TitleId = "22A0"; var request = new GetAccountInfoRequest(); PlayFabClientAPI.GetAccountInfo(request, OnGetPlayFabIdSuccess, <br> OnGetPlayFabIdFailed); return request.PlayFabId; } public static string GetMoney(string playFabId) { string amount = ""; //This one is for getting the data I want, the amount of money that the account has: PlayFabClientAPI.GetUserData(new GetUserDataRequest() { PlayFabId = playFabId, Keys = null }, result => { Debug.Log("Got user data:"); if (result.Data == null || !result.Data.ContainsKey("Money")) { Debug.Log("No value for money"); } else { amount = result.Data["Money"].Value; Debug.Log(amount); } }, (error) => { Debug.Log("Got error retrieving user data:"); Debug.Log(error.GenerateErrorReport()); }); return amount; } //Here is where I call the methods and try to get the data into a textview. public Text moneyText; void Start () { string playFabId = DataBaseManager.GetPlayFabId(); Debug.Log(playFabId); string money = DataBaseManager.GetMoney(playFabId); Debug.Log(money); moneyText.text = money; }