Equipment Management
The NinjaEquipmentManagerComponent is the core of the Equipment layer in the Inventory System. This is an optional
component that must be added to Inventory Avatars that will receive physical representations of items added to
their inventories.
A physical representation is an actor or mesh asset that is shown in the game world. This is usually
relevant for players, and potentially for certain NPCs or enemies, but it is most likely irrelevant for
chests, vendors, or other non-character actors.
Inventory Integration
The Equipment Manager waits for the inventory to initialize, so it can bind to relevant events. The Inventory and
Equipment Manager will usually coexist as follows:
Component | Location |
|---|---|
| Added to the Inventory Avatar (e.g., Player Character) or to the Player State. |
| Always added to the Inventory Avatar. Will search for the Inventory in the Avatar first, then the Player State. |
Equipment Interface
Similar to the Inventory owner, you can add implement IEquipmentSystemInterface in your avatar. This interface provides direct access to the avatar's mesh and animation instance, so these are correctly selected by the Equipment Manager, when an equipment instance is being attached or an animation layer is being linked.
Item Eligibility
The Equipment Manager watches for items being added or removed from the inventory. If the item meets the
equipment eligibility criteria, it will be processed automatically.
To be eligible, the item must:
Have an Equipment Fragment.
Be placed inside an Equipment Container.
Equipment Management
Most equipment logic is handled automatically through inventory events and fragment-driven state transitions.
However, the Equipment Manager provides functions for querying and interacting with equipment programmatically.
Function | Description |
|---|---|
| Checks whether there is an active equipment instance for the given item. |
| Returns the number of currently active equipment instances. |
| Returns all equipment instances created for a given item. |
| Returns all equipment instances that match a |
| Returns the first equipment instance matching a |
| Returns all inventory items that currently have active equipment instances. |
Attachment Parent Finders
Attachment Parent Finders are strategy objects that determine how to resolve the parent component
used for attaching an equipment actor or mesh.
They are typically used by the Equipment Fragment and can be overridden per Equipment State.
The system includes several built-in finders:
Finder | Description |
|---|---|
| Always returns the avatar’s main mesh (e.g., |
| Searches the avatar for a component with a matching |
| Calls |
Custom Finders
You can create your own finder by subclassing NinjaEquipmentAttachParentFinder and overriding the FindAttachParent method. This allows you to define custom rules, such as attachment based on item tags, actor states, or animation conditions.
Component Destruction
When the Equipment Manager component reaches its EndPlay lifecycle function, which usually means that the owner was destroyed, any equipment presence active equipment instances will be destroyed.