docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AddItem

    AddItem(string, int)

    Adds a new entry of the specified InventoryItemDefinition by Id. Returns the new or existing InventoryItem. Returns the new InventoryItem when the InventoryItem didn't already exist in the Wallet and returns an existing InventoryItem when the InventoryItem was already in the Wallet.

    Declaration
    public static InventoryItem AddItem(string itemdefinitionId, int quantity = 1)
    Parameters
    Type Name Description
    string itemdefinitionId

    The Id of the InventoryItemDefinition we are adding.

    int quantity

    How many of this InventoryItem we are adding.

    Returns
    Type Description
    InventoryItem

    The new InventoryItem that was added, or null if Id is invalid.

    AddItem(int, int)

    Adds more of the specified InventoryItemDefinition by Hash. Returns the new (or existing) InventoryItem. Returns the new InventoryItem when the InventoryItem didn't already exist in the Wallet and returns an existing reference when to the InventoryItem when the InventoryItem was already in the Wallet.

    Declaration
    public static InventoryItem AddItem(int itemDefinitionHash, int quantity = 1)
    Parameters
    Type Name Description
    int itemDefinitionHash

    The Hash of the InventoryItemDefinition we are adding.

    int quantity

    How many of this InventoryItem we are adding.

    Returns
    Type Description
    InventoryItem

    The InventoryItem that was added.

    AddItem(InventoryItemDefinition, int)

    Adds more of the specified InventoryItemDefinition. Returns the new (or existing) InventoryItem. Returns the new InventoryItem when the InventoryItem didn't already exist in the Wallet and returns an existing reference when to the InventoryItem when the InventoryItem was already in the Wallet.

    Declaration
    public static InventoryItem AddItem(InventoryItemDefinition itemDefinition, int quantity = 1)
    Parameters
    Type Name Description
    InventoryItemDefinition itemDefinition

    The InventoryItemDefinition we are adding.

    int quantity

    How many of this InventoryItem we are adding.

    Returns
    Type Description
    InventoryItem

    The InventoryItem that was added.

    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)