question

sezeraktemur avatar image
sezeraktemur asked

GetUserInventory returns null

I am using Inventory v2 and I have Items on my Inventory. However couldn't get the list of it. It returns nothing.

  public List<ItemInstance> Inventory;
    
     public void Start()
     {
         if (string.IsNullOrEmpty(PlayFabSettings.staticSettings.TitleId))
         {
             PlayFabSettings.staticSettings.TitleId = "*****";
    
         }
         var request = new LoginWithCustomIDRequest { CustomId = "Temurlogin", CreateAccount = true };
         PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure);
     }
    
     private void OnLoginSuccess(PlayFab.ClientModels.LoginResult result)
     {
         getInventory();
     }
    
     private void getInventory()
     {
         PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(), result =>
         {
             foreach (var item in result.Inventory)
             {
                 Debug.Log(item.DisplayName + ":" + item.CatalogVersion);
                 Inventory.Add(item);
             }
         }, error =>
         {
             Debug.LogError(error.GenerateErrorReport());
         });
     }
apisunity3d
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

·
drallcom3 avatar image
drallcom3 answered

PlayFabClientAPI.GetUserInventory is v1.

PlayFabEconomyAPI.GetInventoryItems is v2.

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.