docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetQuantity

    GetQuantity(string)

    Gets the Quantity of an InventoryItem by its InventoryItemDefinition id

    Declaration
    public int GetQuantity(string inventoryItemDefinitionId)
    Parameters
    Type Name Description
    string inventoryItemDefinitionId

    InventoryItemDefinition id of the item's quantity to get

    Returns
    Type Description
    int

    Quantity of the requested Inventory Item.

    Exceptions
    Type Condition
    ArgumentNullException

    The parameter id is null or empty

    GetQuantity(int)

    Gets the Quantity of an InventoryItem by its InventoryItemDefinition hash

    Declaration
    public int GetQuantity(int inventoryItemDefinitionHash)
    Parameters
    Type Name Description
    int inventoryItemDefinitionHash

    InventoryItemDefinition hash of the item's quantity to get

    Returns
    Type Description
    int

    Quantity of the requested Inventory Item.

    Exceptions
    Type Condition
    KeyNotFoundException

    The hash provided doesn't correspond to a valid item

    GetQuantity(InventoryItem)

    Gets the Quantity of an InventoryItem by its reference

    Declaration
    public int GetQuantity(InventoryItem inventoryItem)
    Parameters
    Type Name Description
    InventoryItem inventoryItem

    InventoryItem reference of the item's quantity to get

    Returns
    Type Description
    int

    Quantity of the requested Inventory Item.

    Exceptions
    Type Condition
    ArgumentNullException

    The parameter id is null

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)