Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Nathan Leadbitter · Apr 18 at 06:18 PM · unity3d

Getting User Title Data with Login Request

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

  • GetPlayerCombinedInfoRequestParams object called InfoRequestParameters, but I'm now thinking it doesnt actually work the way I think it does. Can anyone help me out?
Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

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

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Nathan Leadbitter · Apr 18 at 06:32 PM

Am I supposed to be using GetUserData = true instead of GetTitleData=true?

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    10 People are following this question.

    avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

    Related Questions

    How to turn the friendslist into a two way street ? 1 Answer

    Generic/unknown HTTP error with CDN 1 Answer

    Using master player to change values in all other players. 1 Answer

    Login with E-Mail or Username? 1 Answer

    Where is App id and Advertising Unit type in Unity Ads? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges