question

San Dich Huu avatar image
San Dich Huu asked

Inventory item instance has no customData

I need customData from itemInstance (inventory). But the following code tell me that all item instance has undefined customData. Any help is appreciate.

5939-image.png

CloudScript
image.png (47.8 KiB)
1 comment
10 |1200

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

San Dich Huu avatar image San Dich Huu commented ·

This is my code as text.

 test(args) {
         var inventory = server.GetUserInventory({ PlayFabId: currentPlayerId }).Inventory;
         var length = inventory.length;
         var response = {
             status: "ok",
             description: ""
         };
            
         for (var i = 0; i < length; i++)
         {
             response.description += " [" + i + "]: " + JSON.stringify(inventory[i].customData);
         }
            
         return response;
     }
0 Likes 0 ·

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

You may change the inventory[i].customData in your code to inventory[i].CustomData. You may refer to Player Item Management - Get User Inventory - REST API (PlayFab Server).

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.