Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    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:
    197
    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