docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class InventoryManager

    Manages all Inventories. Can subscribe to events relevant to Inventories and create and remove them here. InventoryManager also owns the main and wallet Inventories, as well as all other Inventories of InventoryItems. The InventoryManager can create Inventories from InventoryDefinitions or default Inventories as needed.

    Inheritance
    object
    InventoryManager
    Namespace: UnityEngine.GameFoundation
    Assembly: solution.dll
    Syntax
    public static class InventoryManager

    Properties

    Name Description
    IsInitialized

    Current initialization state of this manager.

    catalog

    This is the InventoryCatalog the InventoryManager uses.

    Methods

    Name Description
    CreateItem(string)

    This will create a new InventoryItem based on the InventoryItemDefinition matching the given key.

    CreateItem(InventoryItemDefinition)

    This will create a new InventoryItem based on the given InventoryItemDefinition.

    FindItem(string)

    Returns an item with the Id wanted.

    FindItemsByDefinition(string)

    Get all items created from the definition with the specified key.

    FindItemsByDefinition(string, ICollection<InventoryItem>)

    Get all items created from the definition with the specified key.

    FindItemsByDefinition(InventoryItemDefinition)

    Gets items filtered with the specified definition.

    FindItemsByDefinition(InventoryItemDefinition, ICollection<InventoryItem>)

    Gets items filtered with the specified definition.

    FindItemsByTag(string)

    Gets items filtered items with the specified tag.

    FindItemsByTag(string, ICollection<InventoryItem>)

    Gets items filtered with the specified tag.

    FindItemsByTag(Tag)

    Gets items filtered with the specified tag.

    FindItemsByTag(Tag, ICollection<InventoryItem>)

    Gets items filtered with the specified tag.

    GetItems()

    Returns an array of all items in the manager.

    GetItems(ICollection<InventoryItem>)

    Fills the given list with all items in the manager. Note: this returns the current state of all items. To ensure that there are no invalid or duplicate entries, the list will always be cleared and 'recycled' (i.e. updated) with current data.

    RemoveAllItems()

    Removes all the items from the player inventory.

    RemoveItem(string)

    This method will remove the Item with the given Item Hash.

    RemoveItem(InventoryItem)

    This method will remove the given Item.

    RemoveItemsByDefinition(string)

    This method will remove the Item that uses the InventoryItemDefinition with the given Hash.

    RemoveItemsByDefinition(InventoryItemDefinition)

    This method will remove the Item that uses the given ItemDefinition.

    ThrowIfNotInitialized()

    Throws an exception if the InventoryManager has not been initialized.

    Events

    Name Description
    itemAdded

    Event fired whenever a new Inventory Item is added.

    itemRemoved

    Event fired whenever an Inventory Item is removed.

    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)