The Drop Table runtime lives in its own assembly so any feature (items, farming, quests, chest rewards, non-item effects) can use the same weighted-roll pattern without referencing the Inventory package.

  • Assembly: CupkekGames.Data.DropTable
  • Namespace: CupkekGames.Data.DropTable
  • Sample path: Library/CupkekGamesSystems/Data.DropTable/Runtime/

CupkekGames.InventorySystem references this assembly so inventory samples and games can keep one drop model everywhere.

What it is

A serializable list of entries: each row is a CatalogKey plus chance and min/max amount, plus Evaluate() that returns concrete DropResult rows (Key string + Amount).

The package does not interpret what the key means. Your game resolves DropResult.Key (and optional catalog id from authoring) to items, heals, currency, scripted events, and so on.

Types

TypeRole
DropEntryKey (CatalogKey), Chance (0–1), MinAmount / MaxAmount
DropResultOutcome: Key (CatalogKey), Amount
DropTableImplements IData; holds entries and evaluation
DropTableSODataSO<DropTable> — create via Create Asset → CupkekGames/Data/Drop Table

DropEntry no longer carries an inventory-only inspector constraint; if you want a picker limited to the item catalog, subclass or wrap DropEntry and apply CatalogKeyConstraint on your field.

Evaluate behavior

Two overloads share the same pipeline:

  1. Evaluate(..., Func<DropEntry, float> chanceModifier) — per-entry chance override; delegates to the full modifier with amountAddition: 0.
  2. Evaluate(..., Func<DropEntry, (float chance, int amountAddition)> modifier) — full control:
    • If modifier is null: effective chance = entry.Chance * chanceMultiplier (then clamped to 0–1).
    • If modifier is non-null: returned chance is the final effective chance (chanceMultiplier is not applied again). Amount range uses amountAddition on both min and max, then clamps so min ≥ 1 and max ≥ min.

Other rules:

  • Entries with an empty Key are skipped.
  • minimumDrops: if not enough entries pass the roll, remaining slots are filled from failed entries in descending effective chance (using the same chance values as above, including modifier).
  • limit: caps how many results are returned. If minimumDrops > limit, the limit is raised to minimumDrops so you never return fewer than the minimum.

Data workflows

DropTable is an IData type used inside DropTableSO, so you get the same default vs actual and JSON tooling patterns as other data-backed assets where your serializer stack supports them.

Migration from older samples / InventorySystem drop types

If you still have code or docs pointing at CupkekGames.InventorySystem for drop types:

  • Use using CupkekGames.Data.DropTable.
  • Rename DropEntry.ItemKeyDropEntry.Key, DropResult.ItemKeyDropResult.Key (a CatalogKey; use result.Key.Key where you previously used a string id).
  • Serialized assets: DropEntry uses [FormerlySerializedAs("ItemKey")] on Key so existing YAML migrates on load in Unity.
  • Add a reference to CupkekGames.Data.DropTable in your asmdef when you reference these types from another assembly.

Settings

Theme

Light

Contrast

Material

Dark

Dim

Material Dark

System

Sidebar(Light & Contrast only)

Light
Dark

Font Family

DM Sans

Wix

Inclusive Sans

AR One Sans

Direction

LTR
RTL