Ninja Bear Studio Plugins Help

Setup

This page will walk you through the pre-requisites and steps necessary to enable the Ninja Inventory plugin.

Installing the Plugin

Once acquired, the plugin can be installed via the Epic Games Launcher. As with any Code Plugin, it can be installed to any compatible engine version.

Once installed, create or open your project and navigate to Edit and then Plugins. In the search bar, type inventory and the Ninja Inventory plugin should appear. Tick the checkbox and restart the engine.

C++ Libraries

If you plan to work with C++ and use classes from the Inventory System, ensure you add the following modules to your Build.cs file:

PublicDependencyModuleNames.AddRange(new [] { "CommonUI", "GameplayAbilities", "GameplayTags", "GameplayTasks", "InputCore", "ModelViewViewModel", "NinjaInventory", "NinjaInventoryCore", "NinjaInventoryEquipment", "NinjaInventoryGameplay", "NinjaInventoryUI", "StructUtils", "UMG" });

Asset Manager

The Inventory System uses Primary Data Assets and soft references to load and unload assets that should only be available when certain items or equipment are obtained.

You can register these assets in the following ways:

  • In the Editor, configure the Asset Manager: Edit > Project Settings > Asset Manager.

  • If you use a Modular Game Feature to add your Inventory, you can register these assets in your Feature configuration.

Asset Name

Base Class

Description

InventoryContainerData

NinjaInventoryContainerDataAsset

Defines the data structure for Inventory Containers.

InventoryItemData

NinjaInventoryItemDataAsset

Defines the data structure for Items and Fragments.

EquipmentData

NinjaEquipmentDataAsset

Defines the data structure for Equipment.

EquipmentSlotData

NinjaEquipmentSlotDataAsset

Default Skeletal Meshes for unused Equipment Slots.

Once configured, your entries in the Asset Manager should look like this:

Inventory Data Assets Setup

Ability System

The Ability System Component is a prerequisite for the system to operate. Ensure that actors using the Inventory Manager Component also have an Ability System Component and implement the AbilitySystemInterface.

If you are using the Inventory Attribute Set, add it along with the appropriate initialization data. Also, review the Abilities to learn more about abilities that should be granted by default.

Inventory Manager

The Inventory Manager is the primary component that must be added to any actor with an inventory.

The Inventory Manager can be added to a Player State or Pawn. Both are equally viable and the decisive factor should be your inventory's persistence. The Player State is usually a good option for inventories that should be kept over respawns or level travel.

During its initialization, the Inventory Manager will wait for the Ability System Component to initialize and obtain an avatar that is not a Player State.

Inventory Provider Interface

After adding the Inventory Manager to the appropriate actor, the next step is to add the InventoryManagerProviderInterface and implement the GetInventoryManager function to return the component.

Equipment Manager

The Equipment Manager is not a mandatory component but will likely be added to any actors using items with a physical presence in the game world.

Similar to the Inventory Manager, the Equipment Manager also has a prerequisite for its initialization, requiring the Inventory Manager to be replicated and initialized.

The Equipment Manager must be added to the actual Pawn, regardless of where the Inventory Manager was added.

Equipment Provider Interface

After adding the Equipment Manager to the appropriate pawn, the next step is to add the EquipmentManagerProviderInterface and implement the GetEquipmentManager function to return the component.

Last modified: 02 September 2024