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

    Returns the current initialization state of the InventoryManager.

    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 id.

    CreateItem(InventoryItemDefinition)

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

    FindItem(string)

    Returns an item with the Id wanted.

    FindItemsByCategory(string)

    Gets items filtered with the specified category.

    FindItemsByCategory(string, ICollection<InventoryItem>)

    Gets items filtered with the specified category.

    FindItemsByCategory(Category)

    Gets items filtered with the specified category.

    FindItemsByCategory(Category, ICollection<InventoryItem>)

    Gets items filtered with the specified category.

    FindItemsByDefinition(string)

    Gets items filtered with the specified definition.

    FindItemsByDefinition(string, ICollection<InventoryItem>)

    Gets items filtered with the specified definition.

    FindItemsByDefinition(InventoryItemDefinition)

    Gets items filtered with the specified definition.

    FindItemsByDefinition(InventoryItemDefinition, ICollection<InventoryItem>)

    Gets items filtered with the specified definition.

    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

    Fired whenever a new Inventory Item is added.

    itemRemoved

    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)