docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CreateInventory

    CreateInventory(string, string)

    This will create a new Inventory by specifying what InventoryDefinition Id to use.

    Declaration
    public static Inventory CreateInventory(string inventoryDefinitionId, string inventoryId)
    Parameters
    Type Name Description
    string inventoryDefinitionId

    The Id of the InventoryDefinition to assign this Inventory.

    string inventoryId

    The Id this inventory will have.

    Returns
    Type Description
    Inventory

    The newly created Inventory based on specified InventoryDefinition.

    CreateInventory(int, string)

    This will create a new Inventory by specifying what InventoryDefinition to use by Hash.

    Declaration
    public static Inventory CreateInventory(int inventoryDefinitionHash, string inventoryId)
    Parameters
    Type Name Description
    int inventoryDefinitionHash

    The Hash of the InventoryDefinition to assign this Inventory.

    string inventoryId

    The Id this Inventory will have.

    Returns
    Type Description
    Inventory

    The newly created Inventory based on the specified InventoryDefinition.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if an invalid Hash is provided.

    ArgumentException

    Thrown if the given Id is null, empty, or a duplicate.

    CreateInventory(InventoryDefinition, string)

    This will create a new Inventory by specifying what InventoryDefinition to use.

    Declaration
    public static Inventory CreateInventory(InventoryDefinition inventoryDefinition, string inventoryId)
    Parameters
    Type Name Description
    InventoryDefinition inventoryDefinition

    The InventoryDefinition to assign this Inventory.

    string inventoryId

    The Id this Inventory will have.

    Returns
    Type Description
    Inventory

    The newly created Inventory based on the specified InventoryDefinition.

    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)