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 kris.hole · Nov 20, 2018 at 06:05 PM · Player Dataunreal

Why does playfab location information not return as a string?

Using playfab with Unreal, the login information when requesting location comes through as FLocationModel.CountryCode and ContinentCode, both of which are enums making it a little bit of a hassle to actually use it with anything outside of playfab, since its ISO strings why not store it as an FString too to make it easier for developer use? The json response has its as 2 letters anyway, i'm struggling to see why it would be stored as something other than a string

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

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by kris.hole · Nov 20, 2018 at 10:29 PM

If anybody does want this functionality you can do the following:
in PlayFabClientDataModels.h::FLocationModel, Line 2722, add these two in there somewhere:

Boxed<FString> CountryCode;
Boxed<FString> ContinentCode;

then add to the constructors to look like this:

FLocationModel() :
            FPlayFabBaseModel(),
            City(),
            pfContinentCode(),
            pfCountryCode(),
            Latitude(),
            Longitude(),
	    CountryCode(),
	    ContinentCode()
            {}


        FLocationModel(const FLocationModel& src) :
            FPlayFabBaseModel(),
            City(src.City),
            pfContinentCode(src.pfContinentCode),
            pfCountryCode(src.pfCountryCode),
            Latitude(src.Latitude),
            Longitude(src.Longitude),
	    CountryCode(src.CountryCode),
	    ContinentCode(src.ContinentCode)
            {}

then in PlayFabClientDataModels.cpp::Line4208,

pfCountryCode = readCountryCodeFromValue(obj->TryGetField(TEXT("CountryCode")));

add the following:


CountryCode = obj->TryGetField(TEXT("CountryCode"))->AsString();

ContinentCode = obj->TryGetField(TEXT("ContinentCode"))->AsString();


Then in your login result handler, you can access it like this:

Result.InfoResultPayload->PlayerProfile->Locations[0].CountryCode.mValue;
Result.InfoResultPayload->PlayerProfile->Locations[0].ContinentCode.mValue;
Comment

People who like this

0 Show 1 · 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 Brendan ♦♦ · Nov 21, 2018 at 11:05 PM 0
Share

If you'd like to see this added to the SDK, feel free to submit a pull request, so that our SDK team can review the changes.

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

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Unreal Engine 4.21 along with Multiplayer Features 1 Answer

    Save and Load player location or other data in UE4 Blueprints? 1 Answer

    Update User Data via Blueprints in UE4? 1 Answer

    Custom Analytics of Specific Action By Player [UE4] 1 Answer

    Where do I find email verification status via blueprints? 2 Answers

    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