docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Inventory

    Contains a runtime list of InventoryItems as well as details which effect this Inventory.

    Inheritance
    object
    GameItem
    BaseCollection<InventoryDefinition, Inventory, InventoryItemDefinition, InventoryItem>
    Inventory
    Inherited Members
    GameItem.displayName
    GameItem.id
    GameItem.hash
    GameItem.definition
    GameItem.categories
    GameItem.GetDetails()
    GameItem.AddDetail<T>()
    GameItem.GetDetail<T>()
    GameItem.RemoveDetail<T>()
    GameItem.GetStatInt(string)
    GameItem.GetStatInt(int)
    GameItem.GetStatFloat(string)
    GameItem.GetStatFloat(int)
    GameItem.SetStatInt(string, int)
    GameItem.SetStatInt(int, int)
    GameItem.SetStatFloat(string, float)
    GameItem.SetStatFloat(int, float)
    Namespace: UnityEngine.GameFoundation
    Assembly: solution.dll
    Syntax
    public class Inventory : BaseCollection<InventoryDefinition, Inventory, InventoryItemDefinition, InventoryItem>

    Properties

    Name Description
    main

    This is a reference to the InventoryManager's main Inventory.

    Methods

    Name Description
    AddItem(int, int)

    Adds a new entry of the specified InventoryItemDefinition by Hash. Returns the new (or existing) reference to the instance. Returns the new reference to the instance when the item didn't already exist in the Inventory and returns an existing reference when to the instance when the Item was already in the Inventory. Items added to the wallet Inventory must contain an attached CurrencyDetailDefinition.

    GetItemDefinition(int)

    Gets an ItemDefinition by its Hash from this Collection.

    GetQuantity(int)

    Gets the Quantity of an InventoryItem by its InventoryItemDefinition hash

    GetQuantity(string)

    Gets the Quantity of an InventoryItem by its InventoryItemDefinition id

    GetQuantity(InventoryItem)

    Gets the Quantity of an InventoryItem by its reference

    SetQuantity(int, int)

    Sets the quantity of the specified InventoryItem by InventoryItemDefinition Hash in this Inventory.

    SetQuantity(string, int)

    Sets the quantity of the specified InventoryItem by InventoryItemDefinition Id in this Inventory.

    SetQuantity(InventoryItem, int)

    Sets the quantity of the InventoryItem instance within this Inventory.

    ToString()

    Returns a summary string for this Inventory.

    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)