Skip to content

Ericdowney/SimpleInventoryExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleInventory Example Project

This is a minimal Unreal Engine 5.6 example project demonstrating how to use the SimpleInventory plugin.

📖 Overview

The project shows how to:

  • Define custom inventory item structs (Weapons & Ammo) that extend FSimpleInventoryItem.
  • Create Data Tables (DT_Weapons and DT_Ammo) that hold metadata for those items.
  • Use a SimpleInventoryDefinitions Data Asset to define multiple inventories (Weapons and Ammunition).
  • Register inventories with the SimpleInventorySubsystem (done in the Level Blueprint for demonstration).
  • Add items into the inventories using Blueprint helper functions (AddWeapon and AddAmmo).

⚠️ Note: This example does not include gameplay (e.g., item pickups or UI). It focuses only on setup and usage of the inventory system. Gameplay examples will be added later.

🛠 Requirements

  • Unreal Engine 5.6+ (tested with 5.6, should with 5.3+, but untested).
  • The SimpleInventory plugin must be installed and enabled.

Note: For the SimpleInventory classes to be available for #include in C++, you must add SimpleInventory as a dependency in your project's .uproject file. As shown below under Modules -> AdditionalDependencies:

{
	"FileVersion": 3,
	"EngineAssociation": "5.6",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "InventoryExample",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				"CoreUObject",
                "SimpleInventory"
			]
		}
	],
	"Plugins": [
		{
			"Name": "ModelingToolsEditorMode",
			"Enabled": true,
			"TargetAllowList": [
				"Editor"
			]
		}
	]
}

🚀 Getting Started

  1. Clone this repository (or download the ZIP).
  2. Open the project in Unreal Engine.
  3. Ensure the SimpleInventory plugin is enabled.
  4. Open the included Level Blueprint to see how inventories are registered and items are added.

📦 Example Content

Custom Item Structs

Two item types are defined to demonstrate extending FSimpleInventoryItem:

// Ammo Item
USTRUCT(BlueprintType)
struct FAmmoInventoryItem : public FSimpleInventoryItem
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Ammo Inventory Item")
    EAmmoType AmmoType;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Ammo Inventory Item")
    TArray<int32> SupportedWeaponIDs;
};

// Weapon Item
USTRUCT(BlueprintType)
struct FWeaponInventoryItem : public FSimpleInventoryItem
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon Inventory Item")
    EWeaponType WeaponType;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon Inventory Item")
    int32 AmmoClipCount;
};

Data Tables

  • DT_Weapons – Defines weapon metadata (EWeaponType, clip size, etc.).
  • DT_Ammo – Defines ammo metadata (EAmmoType, supported weapons, etc.).

These tables serve as the source of truth for all item definitions.

Inventory Definitions

A SimpleInventoryDefinitions Data Asset defines two inventories:

  • Weapons Inventory
  • Ammunition Inventory

These are registered with the USimpleInventorySubsystem in the Level Blueprint for demonstration.

Level Blueprint Functions

Two helper functions are included in the Level Blueprint:

  • AddWeapon (FWeaponInventoryItem) – Adds a weapon to the Weapons Inventory.
  • AddAmmo (FAmmoInventoryItem) – Adds ammo to the Ammunition Inventory.

These show how to pass custom structs into the inventory system.

📚 What You’ll Learn

By exploring this project, you’ll learn how to:

  • Extend FSimpleInventoryItem to create custom inventory item types.
  • Organize metadata using Data Tables.
  • Define multiple inventories using a Data Asset.
  • Register inventories and add items using Blueprints.

⚠️ Limitations

  • No gameplay interaction yet (no pickups, UI, or player inventory management).
  • Inventories are registered in the Level Blueprint (for simplicity).
    • For production: register them in a custom GameInstanceSubsystem, PlayerController, or another persistent system.

📄 License

MIT License – free to use in commercial and non-commercial projects. © Eric Downey, 2025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published