Usable items
The inventory knows an item was used. It does not know what "used" means — that is your game, and the seam between the two is a single event.
The fragment
FEDUsableFragment makes an item usable:
| Field | Meaning |
|---|---|
| Use Effect Tag | What using it means, e.g. Inventory.UseEffect.Heal. The inventory never interprets this. |
| Use Verb | The UI label — "Eat", "Drink", "Read". Defaults to "Use". |
| Consume On Use | Whether a unit is spent. |
| Units Per Use | How many, when it is. |
An item with no Usable fragment cannot be used, and IsUsable says so.
Using one
// Authority only.
UEDUsableStatics::TryUseItem(Container, Handle);
// Safe anywhere: runs now on the authority, travels to the server from a client.
UEDUsableStatics::RequestUseItem(Container, Handle);
Is Usable (Entry) → Boolean
Get Use Info (Entry) → Tag, Verb, Consumes, Units
Request Use Item (Container, Handle)
RequestUseItem runs an FEDUseItemTransaction: consumption and the effect happen together, or
neither does.
The handoff
The item is consumed by the inventory; the effect is yours. Subscribe once:
void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
if (UEDUsableSubsystem* Usable = UEDUsableSubsystem::Get(this))
{
Usable->OnItemUsed.AddDynamic(this, &AMyCharacter::HandleItemUsed);
}
}
void AMyCharacter::HandleItemUsed(const FEDItemUsedEvent& Event)
{
// Event.UseEffectTag, Event.Instigator, Event.Container, Event.Handle
if (const TSubclassOf<UGameplayEffect>* Effect = UseEffectMap.Find(Event.UseEffectTag))
{
ApplyGameplayEffectToSelf(*Effect);
}
}
A tag-to-effect map is the pattern the demo uses, and it is worth copying: adding a new consumable becomes an item asset plus a map entry, with no code.
OnItemUsed fires on the authority. Replicate whatever the player should see — a GAS effect
already replicates, so usually there is nothing to do.
Why the inventory does not apply the effect
Because Core has no dependency on GAS, and should not. An inventory that knew about health would be an inventory you could not use in a game without health.
The tag is the seam. What it means is a decision the inventory is not qualified to make.
Cooldowns and conditions
Neither is in the fragment, on purpose. A cooldown is a gameplay concern with a dozen reasonable
implementations; gate RequestUseItem behind whatever your game already uses.
For conditions that are about the item — "requires a lit torch", "requires Strength 12" — use a Prerequisites fragment. Those are evaluated by the inventory at the acceptance gate and come back as player-readable text.
Where next
- Gameplay Ability System — items that grant abilities while held
- Items and fragments