Skip to content

Attributes ▸ Crafting Integration

One component: AttributeLevelSource, which answers Crafting's ICraftingLevelSource from an attribute.

What it does

LevelGateValidator gates recipes by asking the owner's chain for an ICraftingLevelSource. This component is one, backed by the Attributes system: it reads a configurable attribute id (default level) through IAttributeSource and reports it as the level.

Put it on the crafting owner, beside or below the owner's AttributeSet. Crafting needs no configuration and no knowledge that Attributes exists.

The mapping decisions, stated

  • FloorToInt. A character at 9.9 is level 9 — partial progress toward a level is not that level. Floor also rounds toward lower entitlement when values are negative.
  • A fallback level, not an exception. When no IAttributeSource is found or the configured attribute does not exist, the serialized fallback (default 0) is reported. Note that LevelGateValidator treats a found source as authoritative — a fallback of 0 gates below its default minimum — so set the fallback to what an unlevelled character should count as in your game.
  • Late binding. The attribute source is re-resolved while none has been found, so an AttributeSet composed later in the frame or loaded additively is picked up on the next query.

What this deliberately is not

There is no write path. Crafting XP raising the level attribute, level curves, and level-up rules all belong to the project — this component answers a question, it does not maintain a progression system.