Why does a return function like this always turn null? Are turn functions returning before the results are queried? If so how would you go about making a function that returns the values after the query?
public string GetUserNameData(string myPlayFabeId, string slot) { string tempName = ""; PlayFabClientAPI.GetUserData(new GetUserDataRequest() { PlayFabId = myPlayFabeId, Keys = null }, result => { Debug.Log("Got user data:"); if (result.Data == null || !result.Data.ContainsKey(slot + "_" + "PlayerName")) { tempName = "Empty Slot"; Debug.Log("No Name"); } else { tempName = result.Data[slot + "_" + "PlayerName"].Value; Debug.Log("PlayerName: " + result.Data[slot + "_" + "PlayerName"].Value); } }, (error) => { Debug.Log("Got error retrieving user data:"); Debug.Log(error.GenerateErrorReport()); }); Debug.Log(slot + "___tempName : " + tempName); return tempName; }