How-To: Add Slots with a Game Feature
Goal: give a pawn class its equipment components and slot layout from a Game Feature, so nothing is hard-wired into the pawn and a Blueprint-only project never touches a graph. (Optional - Quick Start adds the components directly.)
1. Add the action to your Game Feature
Open your Game Feature Data asset, find the Actions array, press +, and choose Add Equipment Slots. The action has one editable property, Slots List - an array of requests, each matching one actor class.
2. Fill in a request
| Property | Default | What it does |
|---|---|---|
Actor Class | empty | The actor class to extend. Every actor of this class (and its children) gets the components. An entry with no class is skipped. |
Slot Layout | empty | The layout applied to the slots component, exactly as you would author it on the component. |
b Server Component | true | Add on the server. |
b Client Component | false | Add on clients as well. Turn this on when client code reads the layout - to draw one UI cell per slot, for example. |
b Add Equipment Manager | false | Also add a manager component, server only, when the actor has none. This is the Blueprint-friendly way to get the manager onto a pawn. |
Slots Component Class | empty | Your slots component subclass. Empty uses UCrimsonEquipmentSlotsComponent. |
Equipment Manager Class | empty | Your manager subclass - the one carrying your gating overrides. Empty uses UCrimsonEquipmentManagerComponent. |
b Add Equipment Manager here adds the manager on the server and lets it replicate down, against any actor class you name - so a pawn gains equipment without its Blueprint being opened at all. Quick Start adds the same component by hand in the Components panel; this is the route for pawns you do not own or do not want to edit.Set Actor Class to your character Blueprint, fill Slot Layout with the same tag/count entries you would put on the component, and tick b Add Equipment Manager. Leave b Client Component off unless your client code reads the layout.
If you made a manager subclass for gating, name it in Equipment Manager Class so the action adds yours rather than the base.
3. Wait for it before you use it
The action runs while the Game Feature activates, so there is a window in which the pawn exists and its equipment components do not. When the layout is applied, the action announces the ModularGameplay feature state Crimson.SystemReady.Equipment (CrimsonEquipment::SystemReadyFeatureName) on that actor, server side.
There is no Blueprint node for ModularGameplay feature states. In Blueprint, bind the manager's On Equipment Changed Message event (it fires as the slots fill), or check Get Equipment Slot Layout on a short timer after possession. In C++, wait on the feature state (right).
BeginPlay, a PlayerState-set callback, or a possession event races the Game Feature and silently finds nothing - the classic version of this bug binds to a component that does not exist yet and simply never fires. Wait on the readiness tag instead.4. Know what deactivation does
Deactivating the Game Feature removes what the action added: it unregisters and destroys the slots component and, if it added one, the manager. It searches by the base classes, so a component of your subclass is still found and removed.
See also
- How-To: Shape the Slot Layout
- How-To: Gate Equipping and Unequipping
- API Reference