Hi all,
I am using the latest Unity SDK, and when my player wants to log in, I'm calling this function:
public void Login(string Username, string Password) { GetPlayerCombinedInfoRequestParams paramters = new GetPlayerCombinedInfoRequestParams(){ GetPlayerProfile = true, GetTitleData = true, GetUserVirtualCurrency = true, GetUserInventory = true }; PlayFabClientAPI.LoginWithPlayFab(new LoginWithPlayFabRequest { Username = Username, Password = Password, InfoRequestParameters = paramters }, LoginSuccess, GetPlayFabError); }
On success, this then runs a login success function which contains:
if (Result.InfoResultPayload.TitleData.ContainsKey("XP")) { Data.Experience = Result.InfoResultPayload.TitleData["XP"]; } else { Data.Experience = "0"; CreateBasicUserData(); }
This is a test account I've been using, and for that account, the "XP" key is set. However the InfoRequestPayload.TitleData is empty, so using something like
Result.InfoResultPayload.TitleData.ToList().ForEach(x => Debug.Log(x.Key));
Returns nothing at all, and thus the else part of the login success gets executed, everytime.
The documentation states that this login method can be sent with a
Answer by Nathan Leadbitter · Apr 18 at 06:55 PM
Solved it, if anyone has a similar issue as me, Title Data in the getplayercombinedinforequestparams is not the USER title data, jokes on me for not reading the documentation properly. Use UserData instead and access the values like Result.InfoResultPayload.UserData["KEYNAME"].Value
Answer by Nathan Leadbitter · Apr 18 at 06:32 PM
Am I supposed to be using GetUserData = true instead of GetTitleData=true?