unfurl

Backpack

A slot inventory with stacks, item fragments, and an optional shape grid for Unreal Engine.

A slot inventory with stacks, item fragments, and an optional shape grid for Unreal Engine.

👀 Summary

NsBackpack is a slot inventory for gameplay programmers. An actor gets a backpack component with a fixed number of slots. Each slot holds an item, a quantity, and optional item data. An item is a data asset with a name, an icon, a mesh, a stack size, and fragments that your game makes. The optional NsBackpackGrid module puts the slots in a grid, where an item covers the cells of its shape.

NsBackpack has no UI, no selected slot, no item use, no crafting, and no save system. It has no server RPCs, so your game sends the change requests to the server. NsBackpack depends on no other plugin.

📦 Features

⚙️ Requirements

Unreal Engine 5.7+

🛠️ Installation

  1. Clone or download this repository.
  2. Copy the NsBackpack folder into the Plugins folder of your project.
  3. Add "NsBackpack" to the dependencies of your game module in Build.cs. Add "NsBackpackGrid" too for a grid.
  4. Generate the project files and enable the plugin.

🚀 Getting Started

  1. Make an item: Content Browser > Miscellaneous > Data Asset > NsBackpackItemDefinition.
  2. Set Display Name and Max Stack on the item.
  3. Add a UNsBackpackComponent to your character.
  4. On the server, call Add Item with the item and a quantity.
  5. Bind On Changed to update your UI.

In C++:

#include "NsBackpackComponent.h"

// In the constructor of the character
Backpack = CreateDefaultSubobject<UNsBackpackComponent>(TEXT("Backpack"));

// On the server. The return value is the quantity that did not fit.
const int32 Left = Backpack->AddItem(BoltItem, 15);

🧩 Modules

Module Content
NsBackpack The slot component, the item definition, the fragment base class, and the slot types
NsBackpackGrid The grid component and the Grid Shape fragment. It depends only on NsBackpack

🔧 API

🚧 Limits

📚 Documentation


Contact