Use an Item Hotbar when the player should assign quick-access slots to Items that remain in the Inventory. A Health Potion can stay in Bag while slot 1 uses it, and a Fire Wand can stay in the same collection while another slot invokes its configured Item Action.

The hotbar stores monitored ItemInfo assignments; it is not another Item Collection. Assigning, moving, or clearing a hotbar slot does not by itself add, remove, or transfer an Item in the Inventory.

A runtime Item Hotbar displaying assigned Item icons in a horizontal row of quick-access slots.

Choose the hotbar behavior

Version 1 includes three useful patterns. The built-in hotbar patterns page provides the short comparison; choose the data model before styling the UI.

Pattern What its slots represent Use it when
Item Hotbar Assignments that monitor Items in the bound Inventory Health Potion should remain in Bag while a key uses it.
Inventory Mirror Hotbar A window onto consecutive entries from an Inventory Grid The quick bar should always reflect the grid’s current filtered and sorted order.
Item Slot Collection View Items held by a dedicated Item Collection A slot must own an equipped or loadout Item rather than monitor Bag.

This page describes Item Hotbar. InventoryMirrorHotbar forwards movement and add/remove operations to its assigned Inventory Grid. An Item Slot Collection View uses collection rules and ownership instead.

Before you begin

Prepare:

  • a player Inventory with a Bag collection and test Items such as Health Potion and Fire Wand;
  • an Item User and Item Actions that already work from the Inventory UI;
  • a UI Designer canvas and duplicated schema;
  • one player-input component that implements IPlayerInput beneath the bound Inventory; and
  • a decision about whether assignments must survive save and load.

Test the Health Potion and Fire Wand actions from Bag first. This separates an Item Action or Item User problem from a hotbar assignment or input problem.

Create the Item Hotbar in UI Designer

  1. Open Tools > Opsive > Ultimate Inventory System > UI Designer and select Hotbar.
  2. In Create, assign the intended Parent Transform.
  3. Set Number of Slots. The creator starts with 3.
  4. Keep Hotbar Type set to Item Hotbar. This is the creator default.
  5. Create the hotbar from the duplicated schema.
  6. In Edit > Hotbar Options, add or remove Item View Slots until the row has the intended size.
  7. Keep the slots in the intended hierarchy order. The container assigns zero-based indexes in that order at runtime.
  8. Confirm that the generated Item View Slots Container Panel Binding binds to the panel owner’s Inventory.

The generated panel starts open and uses its panel binding to initialize, draw, and select the hotbar. The Item Hotbar itself can leave Inventory unassigned in the prefab when the panel binding supplies it at runtime.

At this editor checkpoint, the hotbar has a stable slot count and order, the panel resolves the correct player Inventory, and the first quick-use input targets slot index 0.

Check the runtime components

The schema creates an Item Hotbar, Item View Drawer, category action-set binding, and Item Hotbar Handler. Keep them on the generated objects unless a replacement provides the same responsibilities.

The Item Hotbar Inspector with the Item Actions Binding and assignment-refresh settings used by the quick-access slots.

Important released Version 1 settings are:

Component and setting Default or generated behavior
Item Hotbar > Item Actions Binding Required. If empty, the component looks for an Item View Slots Container Item Action Binding on the same GameObject.
Item Hotbar > Remove Item If Amount Is 0 Off by default. When enabled, a monitored assignment clears after no matching Item remains in the Inventory.
Item View Slots Container > Container Name The schema uses Hotbar. Keep names distinct when code looks up several containers.
Item View Slots Container > Slot Cursor ID Defaults to 1 when no Slot Cursor reference is assigned.
Item View Slots Container > Draw On Enable Off by default; the panel binding handles the initial draw.
Item View Slots Container > Draw On Inventory Update On by default so amounts and runtime Item state refresh after Inventory changes.
Item View Slots Container > Swap Item View On Assign Enabled by the supplied schema so the Item View Drawer can choose the matching prefab for the assigned Item.
Category Item Action Set Binding > Use Item On Click On by default. Clicking or submitting a slot invokes the configured action path.
Category Item Action Set Binding > Use Item Action Index The base component defaults to -1, which invokes all matching actions. The supplied hotbar schema sets it to 0, the first action.
Category Item Action Set Binding > Auto Set Item User On by default. The binding uses the bound Inventory’s Item User.
Category Item Action Set Binding > Max Number Of Actions Defaults to 5. Increase it only when a category can expose more actions through this binding.

Keep the Item View Drawer Content and the Item Hotbar Content on the same slot parent. Keep Use View Slots enabled and assign a Category Item View Set that can display both Health Potion and Fire Wand.

Configure what each slot uses

ItemHotbar.UseItem(index) delegates to the Item Actions Binding. With the supplied Category Item Action Set Binding, the assigned Item’s category chooses the available actions.

  • Set Use Item Action Index to the one action that quick input should invoke. The schema value 0 invokes the first matching action.
  • Use -1 only when every matching action should run from one input. This is rarely appropriate for a hotbar with several unrelated actions.
  • Leave Use Item On Click enabled when pointer click or UI submit should behave like the indexed shortcut.
  • Use an Action Panel only when choosing among actions after selecting the slot is intentional.
  • Give Health Potion a quick-use action and give Fire Wand the project’s intended use or equip action. Assigning either Item must not invoke the action immediately.

The Item Hotbar refreshes every assigned slot before drawing. It first checks the original Item Collection for the current amount, then looks elsewhere in the same Inventory for the same Item if that collection no longer contains it. With Remove Item If Amount Is 0 off, a missing Item can remain assigned with amount 0; with it on, the slot clears.

Configure indexed input

Item Hotbar Handler polls an array of Hotbar Input entries. The supplied defaults map indexes 0 through 9 to Equip First Item through Equip Tenth Item, using Button Down.

  1. Keep Item Hotbar assigned, or leave it empty when the handler is on the same GameObject and should find that component at startup.
  2. Keep only the Hotbar Input entries used by the visible slots.
  3. Match each entry’s Index to the intended zero-based slot.
  4. Define the named inputs in the chosen Opsive player-input implementation.
  5. Test keyboard, controller, or the installed input integration separately.

The handler finds IPlayerInput under the bound Inventory. If it cannot find one, it disables itself. It also listens for the character’s Enable Gameplay Input event, so the built-in shortcuts stop while that player’s gameplay input is disabled.

Let the player assign and clear slots

The supplied AssignHotbarItemAction is a demo Item Action that opens an asynchronous integer-choice panel and assigns the selected slot.

  1. Add Assign Hotbar Item Action to an Item Action Set available from the Bag UI.
  2. Assign a compatible Async Func Action Panel Prefab. The supplied integer panel returns a slot index and uses -1 for cancel.
  3. Keep Hotbar Panel Name equal to the generated panel’s exact name. Its default is Item Hotbar.
  4. Set Display Panel Manager ID to the correct manager when the scene has more than one. Its default is 0, which can fall back to the action’s parent panel manager or a scene lookup.
  5. Enable Toggle Assign when choosing the same Item and slot again should clear the assignment. It is off by default.
  6. Enable Show Item Names when the choice list should show the current assigned names instead of slot numbers. It is off by default.
  7. Leave Use Item View Slot If Available enabled when the panel buttons are Item View Slots and should show their current assignments. It is on by default.

Use UnAssignHotbarItemAction from the hotbar for an explicit clear action. It calls UnAssignSlot and leaves the Item in its Inventory collection.

For drag-and-drop, use the standard smart-exchange condition and action supplied by the schema. Version 1 treats a destination Item Hotbar as an assignment target and does not remove the source Item from the same Inventory. Use ItemViewDropContainerRemoveAction when dragging away from the hotbar should clear the source assignment; its Remove From Source Container setting is on by default.

Save assignments when required

Hotbar assignments are UI container state. Saving the Inventory alone preserves the Items but not necessarily the slot mapping.

Add Item View Slots Container Saver to the hotbar when assignments must persist, and assign its Item View Slots Container reference. When the reference is empty, the saver looks for a container on the same GameObject. It stores an ItemStack identity for every slot and restores each match from the bound Inventory by index.

The Inventory must also have its normal saver, and its ItemStacks must exist before the hotbar mapping is restored. Give each local player’s saver a distinct Full Key through a distinct GameObject name, Saver Key, or both.

Keep player ownership explicit

For local multiplayer, create one hotbar panel per player. Bind each panel to that player’s Inventory, keep its Item Hotbar Handler with that player’s IPlayerInput, and route AssignHotbarItemAction to that player’s Display Panel Manager. The same panel name can be reused inside different managers, but a global manager lookup must not choose another player’s hotbar.

Item Hotbar assignments are local runtime UI state. Released Version 1 does not include hotbar-assignment network replication. A networked game must synchronize the authoritative assignment separately and validate the invoked Item Action on the owning player or server. Synchronizing the Inventory alone does not reproduce the slot mapping.

Editor checkpoint

Before entering Play Mode, confirm that:

  • Hotbar Type is Item Hotbar rather than Inventory Mirror Hotbar;
  • the number and hierarchy order of Item View Slots match the indexed inputs;
  • the panel binding resolves the intended player Inventory;
  • Item Actions Binding, Category Item Action Set, Item User, and Item View Drawer are assigned;
  • Use Item Action Index invokes only the intended quick action;
  • the Item Hotbar Handler can find the correct player’s IPlayerInput;
  • Hotbar Panel Name and Display Panel Manager ID resolve the intended panel;
  • assignment and drop actions monitor Items instead of transferring them from Bag; and
  • Item View Slots Container Saver is present only when assignments must persist.

Verify in Play Mode

  1. Assign Health Potion from Bag to slot 1. Confirm that the Item remains in Bag and its Icon and amount appear in the hotbar.
  2. Press the first indexed input. Confirm that the intended Health Potion action runs once and the displayed amount refreshes.
  3. Assign Fire Wand to slot 2. Confirm that the second input invokes only its intended Item Action.
  4. Reassign Health Potion to another slot with Toggle Assign enabled, then choose the same slot again. Confirm that the expected slot moves or clears without moving the Item from Bag.
  5. Drag an Item from Bag onto the hotbar, then drag it away using the remove action. Confirm that only the assignment changes.
  6. Remove all Health Potions from the Inventory. Test Remove Item If Amount Is 0 both off and on and confirm the zero-amount or cleared result.
  7. Disable gameplay input by opening the configured menu. Confirm that hotbar shortcuts stop for that player and resume afterward.
  8. If saving is configured, save, change the assignments, then load. Confirm that the assigned ItemStacks return to the same slot indexes.

Troubleshooting

Symptom Check Fix
The hotbar is empty after assignment Panel binding Inventory, Item View Slots, Content, and Category Item View Set Bind the correct Inventory and restore the generated slot and drawer references.
Pressing a shortcut does nothing Item Hotbar Handler, IPlayerInput, input name/type, slot index, and gameplay-input state Use the intended player’s input component, correct the index, and confirm gameplay input is enabled.
The wrong slot fires Hotbar Input Index values and Item View Slot hierarchy order Make both zero-based orders match.
One press invokes several actions Category Item Action Set and Use Item Action Index Select one action index instead of -1, or simplify the category’s hotbar actions.
Assign Hotbar Item Action cannot find the hotbar Display Panel Manager ID, Hotbar Panel Name, and panel binding Route the action to the correct manager and use the panel’s exact name.
The assignment panel does not open Async Func Action Panel Prefab and parent Display Panel Assign a compatible integer action panel prefab and invoke from a bound panel context.
Assigning removes the Item from Bag Hotbar type and drag/drop action set Use Item Hotbar and its smart-assignment path, not a give/exchange action or collection-backed view.
Clearing a slot removes the Item Unassign action and drop remove target Use UnAssignHotbarItemAction or remove from the hotbar source container only.
The amount does not refresh Draw On Inventory Update, bound Inventory, and original Item Collection Enable redraw on Inventory update and bind the hotbar to the Inventory that owns the Item.
A missing Item remains with amount 0 Remove Item If Amount Is 0 Enable it when assignments should clear as soon as no matching Item remains.
Assignments disappear after loading Item View Slots Container Saver, Inventory saver, load order, and Saver Full Keys Save both states, load Inventory ItemStacks first, and give each saver a unique key.
Player two uses player one’s hotbar Panel-owner Inventory, Display Panel Manager ID, and player input ownership Give each player a separate bound panel, manager route, handler, and saver key.

Developer reference

The main runtime methods are AssignItemToSlot, ToggleAssignItemToSlot, UnassignItemFromSlots, UnAssignSlot, and UseItem. ItemHotbar.CanGiveItem always returns false, which is the ownership boundary that distinguishes monitored assignments from a collection-backed container.

hotbar.AssignItemToSlot(itemInfo, 0);
hotbar.UseItem(0);
hotbar.UnAssignSlot(0);

ItemViewSlotsContainerBase exposes Inventory bind/unbind, slot selection, click, pointer, draw, and reset events. Assignment itself does not publish a dedicated hotbar-changed event in Version 1. ItemHotbarHandler listens for c_CharacterGameObject_OnEnableGameplayInput_Bool to gate indexed input, while ItemViewSlotsContainerSaver serializes and restores the slot-to-ItemStack mapping.