Inventory Menu Item
Introduction
The menu item used to display an inventory item
Dependencies
The InventoryMenuItem relies on other components of this plugin to work:
- Logger: Used to log useful information to help you debug any issues you might experience
Optional Widgets
You can add the following widgets to enable extra functionality:
| Name | Description | Type |
|---|---|---|
| InventoryImage | The image of the inventory item | UImage* |
API Reference
Properties
| Property | Description | Type | Default Value |
|---|
Functions
| Name | Description | Params | Return |
|---|---|---|---|
| InitializeEmptyInventoryItem | Initialize an empty inventory item | Widget (UInventoryWidget*) The widget that owns this menu item |
|
| InitializeInventoryItem | Initialize a non-empty inventory item | Widget (UInventoryWidget*) The widget that owns this menu item Item (FInventoryItem) The item tracked by this menu item Data (FInventoryItemData) The data for this menu item |
|
| UpdateInventoryGridPosition | Update the grid position of the inventory menu item | CurrentColumn (int) The current column of the inventory menu item CurrentRow (int) The current row of the inventory menu item |
|
| GetInventoryItem | Get the inventory item tracked by this menu item | FInventoryItem The inventory item tracked by this menu item |
|
| UpdateAmount | Update the amount of the inventory item | Amount (int) The new amount of the inventory item |
Blueprint Usage
You can use the InventoryMenuItem using Blueprints by adding one of the following nodes:
- Ultimate Starter Kit > Inventory > Initialize Empty Inventory Item
- Ultimate Starter Kit > Inventory > Initialize Inventory Item
- Ultimate Starter Kit > Inventory > Update Inventory Grid Position
- Ultimate Starter Kit > Inventory > Get Inventory Item
- Ultimate Starter Kit > Inventory > Update Amount
C++ Usage
Before you can use the plugin, you first need to enable the plugin in your Build.cs file:
PublicDependencyModuleNames.Add("USK");
The InventoryMenuItem can now be used in any of your C++ files:
#include "USK/Inventory/InventoryMenuItem.h"
void ATestActor::Test()
{
// InventoryMenuItem is a pointer to the UInventoryMenuItem
InventoryMenuItem->InitializeEmptyInventoryItem(Widget);
InventoryMenuItem->InitializeInventoryItem(Widget, Item, Data);
InventoryMenuItem->UpdateInventoryGridPosition(CurrentColumn, CurrentRow);
FInventoryItem InventoryItem = InventoryMenuItem->GetInventoryItem();
InventoryMenuItem->UpdateAmount(Amount);
}