question

jrDev avatar image
jrDev asked

Inventory Item Custom Data null

Hello,

 

So I am trying to retrieve the Custom Data from one of the items in my Catalog for a user but it always comes up null.

GetUserCombinedInfoRequest request = new GetUserCombinedInfoRequest(){
PlayFabId = PlayfabID,
};

PlayFabClientAPI.GetUserCombinedInfo(request, (result) => {

Debug.Log(result.Inventory[0].CustomData);

}

Any help is appreciated.

 

Thanks,

jrDev

10 |1200

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

brendan avatar image
brendan answered

GetUserCombinedInfo queries the user's inventory, not the catalog.

The distinction is this:

Catalog items have custom data which is global - all players share those values, as they're set at the catalog level. Change them in the catalog to re-balance your game, and all players are using those values.

Inventory item instances are unique instances of the items from the catalog, in the player inventory. They also have a separate custom data space, which can be used for any data which is unique to that specific instance of the item. So, if you have items that wear out or you can add enchantments to them to increase their power, that's where you'd keep track of those values.

10 |1200

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

jrDev avatar image
jrDev answered

I am confused, so I want to get the inventory of the player. I am currently testing this so I awarded the player from the GameManager  2 items that get added to their inventory, when I use GetUserCombinedInfo I can get the 2 items awarded I just don't see the Custom Data info. The API doesn't make this clear what its supposed to do.

 

Thanks,

jrDev

10 |1200

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

brendan avatar image
brendan answered

If you haven't added any custom data on those item instances yet, they won't have any. If you're trying to see the custom data that's defined in the catalog, you need to retrieve the catalog itself (GetCatalogItems).

10 |1200

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

jrDev avatar image
jrDev answered

Thanks for the info!

10 |1200

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

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.