API
Assembly: Spark.ItemBar Interface: IItemBarPlugin Implementation: ItemBarPlugin
Interface
public interface IItemBarPlugin
{
void RegisterItemBarEntity(ItemBarEntity entity);
void UnregisterItemBarEntity(ItemBarEntity entity);
void SelectSlot(GameObject target, int slotIndex);
void CycleSlot(GameObject target, int direction);
int GetSelectedSlotIndex(GameObject target);
ItemBarSlot GetSelectedSlot(GameObject target);
}ItemBarEntry
Extends SparkDatabaseEntry. Defines item bar behavior.
allowedItemTypes
List<ItemTypeBase>
Item types this bar accepts
Methods:
bool CanAcceptItemType(ItemTypeBase itemType)
bool CanAcceptItem(ItemEntry itemEntry)
bool CanAcceptItem(ItemInstance itemInstance)ItemBarSlot
Represents a single slot in the item bar.
Methods:
Events: OnSlotChanged, OnItemSlotted, OnItemRemoved
Commands
SelectItemBarSlotCommand
target (GameObject), slotIndex
Select a slot
CycleItemBarSlotCommand
target (GameObject), direction
Cycle selection
Components
ItemBarEntity
MonoBehaviour that manages an item bar on an entity.
Configuration:
numberOfSlots
int
Slot count (1-20)
selectedSlotIndex
int
Initially selected slot
scrollInputAction
InputActionReference
Scroll wheel input
enableScrollCycling
bool
Scroll to cycle slots
invertScrollDirection
bool
Reverse scroll direction
autoEquipItems
bool
Auto-equip slotted items
equipmentEntity
EquipmentEntity
Equipment reference
isPersistent
bool
Save to disk
loadOnInitialize
bool
Load from save on enable
autoSaveOnChange
bool
Save on every change
Methods:
Integrates with the Rules plugin to prevent slot switching while UI is open or abilities are active.
Events: OnSlotSelected, OnSlotItemChanged
Save Data
ItemBarPluginSaveData
Extends SaveDataEntry.
Methods:
SerializedItemBarData
entityId
string
Owner entity
selectedSlotIndex
int
Selected slot
slots
List<SerializedItemBarSlotData>
Slot contents
SerializedItemBarSlotData
slotIndex
int
Slot position
itemEntryId
string
Item in slot
quantity
int
Stack count
isLocked
bool
Lock state
Usage
Last updated
Was this helpful?
