question

Dmitrii Osipov avatar image
Dmitrii Osipov asked

Empty Custom data for item instances

GetInventoryItems for client api and GetUserInventory for server api returns "null" instead of Custom item data. Item in game manager => http://puu.sh/q83Xh/d06e8e7847.png Incoming item in client api => http://puu.sh/q843E/50f0275e9f.png and from cloud script log => http://puu.sh/q847b/0dd1f45d9c.png

Player DatasdksPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

CustomData in the catalog is global - you read it from that source, so that it applies equally to all instances. When you instance an item, you have the ability to set unique CustomData on it - that would be distinct from the catalog CustomData. Please have a look at this post for more info: https://community.playfab.com/questions/3752/read-custom-data-from-iteminstance.html.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dmitrii Osipov avatar image Dmitrii Osipov commented ·

Oh, sorry for my inattention. Thanx alot. Now it's clear how all this stuff works. One more question. Does server requests, such as GetCatalogItems caches in cloud script? Or how i can cache this stuff. I need to hadle a catalog items, user items, user currencies and some of game title data in one call and getting all theese stuff wastes alot of time. So i think about some caching for data which is not changes. Thanx alot again.

0 Likes 0 ·
brendan avatar image brendan Dmitrii Osipov commented ·

In general, yes, we would recommend caching all of that on the client. You can read global items like catalog and title data into a static in Cloud Script, but there's no guarantee it'll be there from call to call, since your scripts could be running on a different V8 engine. Individual user data can't be cached in Cloud Script, since many different users will use the same engine.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.