Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Documentation errors/updates

Discussion in 'Economy' started by lambch0p, Dec 1, 2021.

  1. lambch0p

    lambch0p

    Joined:
    Oct 22, 2014
    Posts:
    62
    Hi,

    I just noticed in the docs that the GetInventoryAsync method states that it requires an AddInventoryItemOptions object. The code samples correctly reference the GetInventoryOptions object.
    https://docs.unity.com/economy/SDK-player-inventory.htm?tocpath=Economy SDK guide|Player inventory|_____1#GetInventory

    Also the code samples make reference to the GetNext() method. This doesn't exist, it should be GetNextAsync().

    Additionally, with regard to paging the data would it be better to show a while loop with the HasNext/GetNext commands rather than an if statement which will only get the next page, instead of iterating through all that remain?


    Code (CSharp):
    1. PlayerInventory.GetInventoryOptions options = new PlayerInventory.GetInventoryOptions
    2. {
    3.     ItemsPerFetch = 5
    4. };
    5. GetInventoryResult inventoryResult = await Economy.PlayerInventory.GetInventoryAsync(options);
    6.  
    7. List<PlayersInventoryItem> listOfItems = inventoryResult.PlayersInventoryItems;
    8.  
    9. //use while to iterate through remaining pages
    10. while (inventoryResult.HasNext) {
    11.     GetInventoryResult nextinventoryResult = await inventoryResult.GetNextAsync(5);
    12. //Do something with the newly retrieved pages
    13. }
     
  2. Laurie-Unity

    Laurie-Unity

    Unity Technologies

    Joined:
    Mar 5, 2020
    Posts:
    220
    Hi,

    Well spotted, thanks for bringing these to our attention.
    We'll get the documentation updated. I hope the inaccuracies didn't slow you down too much.

    Thanks,
    Laurie