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 Jerry · Jun 25, 2019 at 01:21 PM · Player InventoryCharacter Data

Read/write Custom data inventory items in unity

Hi,

So for the past 12 hours I've been trying to access the custom data values on the items in a specific player from my server. The purpose is to read and write to this custom data with the unity app. I'm been able to get pretty much every other form of info from a certain player. But the custom data is always null I've tried json to convert it into a string but still it returns null. Is there perhaps an example for doing this if its even possible to do it outside the game manager. I'm also posting on my phone so I'm unable to post my code. Any help would be appreciated.

Comment

People who like this

0 Show 1
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 Jerry · Jun 25, 2019 at 08:19 PM 1
Share

I think i found a solution that i will post here once i'm done with it for the others out there who aren't really good with code, and doesn't understand PlayFab all the way.

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Jerry · Jun 26, 2019 at 02:43 AM

OK,

So in Unity you might want to create a new user and have their inventory items set up for them when the game is launched for the first time.

to add these items to the players inventory you could do it from a server,client or cloud script(which ever you choose is up to you,and the method be it via granting, or purchasing(i would suggest granting via cloud script)

once you have that working you'll notice that you cant access the item instance custom data, but when you view the data via the game manager you can see it.

the reason is that when you click the item it takes you to catalog of items(this is the place where you created the items)

to view the custom data for each item click the show custom data button which is the blue (normally white)

when giving the items they don't get sent with custom data you put catalog for some reason, there must be a option that i over looked which will allow this when its being created.

but because each item in a players inventory has a unique id you can now update each item to have different values which would probably be the end objective cause each player will need different level items for example.

here is a few posts that talk about how what type of granting will affect the custom data

Here

and here for limits on the number of values a catalog can have and the number of values an item in a players inventory can have.


capture.png (23.2 kB)
Comment

People who like this

0 Show 2 · 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 Jerry · Jun 25, 2019 at 09:49 PM 0
Share

About Item Data

Note that individual item instances only store the following information:

  • Item ID
  • Display name
  • Item class
  • Catalog version
  • Purchase date
  • Purchase currency
  • Purchase price

All other item information (such as tags, description, or custom data) is only stored on the root catalog item.

so this means you just need to update the customs data with the ones that are used in the catalog after adding those items to the players inventory.

avatar image Tuomas Erikoinen · Feb 11, 2020 at 08:56 AM 0
Share

Ah, thank you very much! I was banging my head on this just because I didn't realize that by clicking the link it takes me to the catalog page and not to the item instance itself.

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

    Setting player data through ue4 blueprints 1 Answer

    How to keep track of Player's inventory 1 Answer

    How should I segment player stat updates from server stat updates 2 Answers

    Getting CustomData from specific user inventory items 4 Answers

    Playfab Player Data Fields ? 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