Item and Currency Droppers

Use a dropper when an enemy death, opened chest, solved puzzle, or another game event should create Item or Currency pickups in the world. Choose the component by where the contents come from and whether the result is fixed or random.

Droppers do not listen for an enemy-death event by themselves. Configure the contents and pickup prefab, then call Drop() from the project event that owns the reward.

Choose a drop workflow

Goal Use Result
Spawn one known Item Info from code Item Object Spawner Creates one configured Item Object at an exact world position.
Let a player drop an Item from an Item Action menu Drop Item Action or Quantity Drop Item Action Creates an Item or Inventory pickup near the Item User or Inventory.
Drop every configured Item from a reward Inventory Item Dropper Creates one Item Pickup per Item Info, or one Inventory Pickup containing the full list.
Select Items from a weighted reward Inventory Random Item Dropper Draws a configured number of results, using source stack Amounts as weights.
Copy a fixed set of currencies into a pickup Currency Dropper Creates one Currency Pickup with the Currency Owner’s current amounts.
Vary a fixed set of currency amounts Random Currency Dropper Multiplies every source amount by one random multiplier before creating the pickup.

The Item Dropper, Random Item Dropper, Currency Dropper, and Random Currency Dropper all inherit the same placement settings:

  • Pick Up Prefab has no default and must contain the expected pickup component on its root GameObject.
  • Drop Transform has no fallback and must be assigned.
  • Drop Radius defaults to 0.

The component spawns at the Drop Transform plus a random horizontal offset inside the radius and a fixed 1 unit upward offset. A radius of 0 still places the pickup one unit above the transform.

Build the pickup prefabs

Match the prefab to the dropper before configuring reward data:

Pickup purpose Required root components What happens on interaction
One Item or stack, such as Health Potion or Iron Sword Item Pickup, Item Object, and Interactable Adds the Item Info to the configured destination collection.
Several Items in one container Inventory Pickup, Inventory, and Interactable Attempts to add the pickup Inventory’s Main contents to the interacting Inventory.
Gold or another Currency Currency Pickup, Currency Owner, and Interactable Adds the pickup Currency Owner’s amounts to the interacting Inventory’s Currency Collection.

Add an Item Object Visualizer or Inventory Item Visualizer when the pickup should select a model from Item attributes. Configure On Pickup Success, On Pickup Fail, On Partial Pickup, and their audio fields on Item and Inventory pickups where the player needs feedback.

Currency Pickup reports success after it attempts to add its Currency amounts; released Version 1 does not translate a Currency capacity or add failure into the pickup’s fail or partial callbacks.

See Item Pickups for destination, capacity, deactivation, and reactivation behavior.

Configure fixed Item drops

Use Item Dropper when the reward list is already known.

  1. Add an Inventory to the reward owner, such as an enemy.
  2. Add an Item Collection named ItemDrops with purpose Drop, matching the Item Dropper’s released Version 1 Item Collection ID defaults.
  3. Put the intended reward Item amounts in that collection. For example, add two Health Potions and one Iron Sword.
  4. Add Item Dropper and assign Inventory, Pick Up Prefab, and Drop Transform.
  5. Choose an Item Pickup prefab to create one world object per Item Info, or an Inventory Pickup prefab to put the whole reward list in one world object.
  6. Keep Drop Copies enabled when the source Inventory is a reusable reward table. It defaults to on.
  7. Keep Split Unique Items enabled when an amount containing unique Items should become separate Item Infos. It also defaults to on.
  8. Disable Allow Empty Drops when an Inventory Pickup must not be created for an empty list. Its default is on.

For common Items, the Item identity is shared by design. For unique Items, Drop Copies creates new runtime Items before binding them to the pickup. With an Item Pickup prefab, the dropper creates one pickup for each resulting Item Info; with an Inventory Pickup prefab, it creates one pickup and replaces its Main collection contents with the result list.

ItemDropper.Drop() does not remove the reward data from its source collection. Turning Drop Copies off changes whether unique Item data is cloned, but it still does not perform an Inventory transfer. Clear or destroy the source explicitly when the original should no longer exist.

Configure weighted Item drops

Use Random Item Dropper when the source Inventory should act as a weighted table.

  1. Configure the base Item Dropper fields and an ItemDrops collection before the component enters Play Mode.
  2. Use each source stack’s Amount as its weight. For example, Health Potion amount 6 and Iron Sword amount 1 make a potion six times as likely as the sword on each draw.
  3. Set Min Amount and Max Amount to the number of draws. Their defaults are 1 and 2.
  4. Leave Amount Probability Distribution empty for a uniform integer count between Min and Max, inclusive.
  5. Add a curve only when the number of draws should favor part of that range. Curve time is sampled from 0 to 1; the clamped curve value maps from Min to Max and is rounded to an integer.

Each draw selects with replacement. Repeated selections of the same Item are combined into one result amount before the inherited copy and split rules run.

The probability table is built once in Awake. Changes to the source collection after that point do not rebuild the table, and the released Version 1 Random Item Dropper has no empty-table guard. Populate at least one positive-weight Item before Play Mode or rebuild the table in a custom component.

For random rarity, Attack, or other Item attributes, continue to Custom Random Item Dropper. That child workflow subclasses Random Item Dropper and modifies mutable, unique Items before their pickups are created.

Configure fixed and random Gold drops

Use a Currency Owner as the reward template:

  1. Add a Currency Owner to the enemy or reward GameObject and give it the base amount, such as 10 Gold.
  2. Add Currency Dropper for an exact copy or Random Currency Dropper for a scaled result.
  3. Assign the source Currency Owner, a Currency Pickup prefab whose root also has its own Currency Owner, and a Drop Transform.
  4. For Random Currency Dropper, set Min Offset and Max Offset. The released Version 1 defaults are 0.3 and 3.

The offsets are multipliers, not percentages added to the base. With 10 Gold and a range of 0.5 to 1.5, the pickup receives the source Currency collection scaled by one uniformly selected multiplier in that range. The same multiplier is applied to every Currency entry in the source owner.

Currency droppers copy amounts into the pickup and do not subtract them from the source Currency Owner. Remove or change the source amount separately when it represents spendable ownership rather than a reward template.

Let the player drop an Item

Use an Item Action when the player initiates the drop from Bag or another UI:

  • Drop Item Action is named Drop. Drop One defaults off, Remove On Drop defaults off, Drop Radius defaults to 2, and Center Offset defaults to zero.
  • Quantity Drop Item Action is also named Drop. It opens the configured Quantity Picker for stacks larger than one, with a range from 1 to the selected amount. Its Remove On Drop default is off and its Drop Radius default is 2.

Both actions use the Item User’s GameObject as the center, falling back to the Item’s Inventory GameObject. Their random offset is a box-like range: horizontal axes run from half a radius below to half a radius above the center, while the vertical axis runs from 0 to the full radius.

Enable Remove On Drop when the pickup should own the Item that leaves Bag. Released Version 1 does not check the returned removal amount before it spawns the requested pickup, so expose the action only for Items and collections that allow the full removal.

The pickup prefab must have an Item Object or Inventory on its root for the action to populate it. Add the corresponding Item Pickup or Inventory Pickup behavior as well when the world object must be collectible.

Use an Item Object Spawner from code

Add Item Object Spawner near the Inventory System Manager when project code already has an Item Info and exact position.

  1. Keep ID at its default 1, or assign a unique value and use the same value for lookup.
  2. Assign Item Object Prefab. The prefab must contain an Item Object and should include Item Pickup and Interactable when it is collectible.
  3. Use Spawn for an immediate object, SpawnWithDelay for a delayed object, or SpawnWithAutoDestroy for scheduled cleanup.

The spawner registers itself in the Inventory System Manager global register during Awake. It uses the supplied world position exactly and does not apply the Dropper radius or upward offset.

Build a Health Potion, Iron Sword, and Gold reward

For an enemy that normally drops consumables, rarely drops equipment, and always drops some Gold:

  1. Create an ItemDrops collection containing Health Potion amount 6 and Iron Sword amount 1.
  2. Configure Random Item Dropper with Min Amount 1, Max Amount 2, Drop Copies on, and Split Unique Items on.
  3. Use an Item Pickup prefab when each selected result should be a separate world object.
  4. Give the enemy’s Currency Owner 10 Gold and configure Random Currency Dropper with multipliers 0.5 and 1.5.
  5. Use separate Drop Transforms or small radii so the Item and Currency pickups do not overlap.
  6. Call both components’ Drop() methods once from the enemy’s confirmed death event.

This setup treats the source Inventory and Currency Owner as reward tables. Repeated enemy instances may reuse the same configuration because the default Item workflow copies unique reward Items and the Currency workflow copies amounts.

Editor checkpoint

Before entering Play Mode, confirm that:

  • every Dropper has a non-null Drop Transform and root-compatible Pick Up Prefab;
  • Item droppers resolve the intended Inventory and ItemDrops collection;
  • the Random Item Dropper has at least one positive-weight Item before Awake;
  • Min Amount is not greater than Max Amount;
  • Drop Copies, Split Unique Items, and Allow Empty Drops match the ownership and empty-result policy;
  • each Currency Dropper resolves a source Currency Owner, and its pickup prefab has both Currency Pickup and Currency Owner;
  • Item Actions use Remove On Drop only where the full source amount can be removed;
  • the project event calls each intended Drop() exactly once; and
  • pickup Interactable settings, layers, destination collection, and feedback callbacks are configured.

Verify in Play Mode

  1. Trigger one fixed Item Dropper. Confirm that the expected Health Potion and Iron Sword contents appear in the correct number of Item or Inventory pickups.
  2. Trigger the Random Item Dropper repeatedly in a test scene. Confirm that every run produces between Min and Max draws and that Health Potion is selected more often than Iron Sword over many runs.
  3. Inspect a dropped unique Iron Sword and confirm it is a copy when Drop Copies is enabled.
  4. Trigger the Currency Dropper and confirm that an exact copy of the source Gold appears. Then test the Random Currency Dropper and confirm that the result stays within the configured multiplier range.
  5. Pick up every result. Confirm that Item pickups report success, partial success, or failure according to destination capacity, and that the Gold reaches the player’s Currency Collection.
  6. Invoke Drop Item Action from Bag with Remove On Drop enabled. Confirm that the chosen amount leaves Bag and the pickup contains that same amount.
  7. Trigger the reward twice only when two reward rolls are intended. Confirm that one death event does not accidentally create duplicate sets.

Save and multiplayer boundaries

Droppers and Item Object Spawner have no dedicated save data for spawned world rewards. Inventory Saver and Currency Owner Saver can preserve their configured source owners, but a runtime pickup’s contents and transform are not automatically recreated after loading merely because a dropper created it.

For persistent ground loot, save the Item or Currency identity, amount, transform, and any claimed state, then restore the pickup explicitly. Random Item tables and Unity random state are not saved by the dropper, so save the selected result rather than rolling it again on load.

The released Version 1 core package does not replicate Drop(), random selection, spawned pickup ownership, or pickup interaction over a network. Run the reward roll on the authority, replicate the resolved results and positions, and prevent clients from rolling independently.

Troubleshooting

Symptom Check Fix
Nothing drops when the enemy dies Death-event binding and whether Drop() is called Connect the confirmed death event to each intended Dropper once.
Drop() throws before spawning Drop Transform, source Inventory or Currency Owner, and Pick Up Prefab Assign every required reference; released Version 1 has no Drop Transform fallback.
Random Item Dropper fails with an empty table ItemDrops contents at Awake and positive stack Amounts Populate the collection before Play Mode or rebuild the table in a subclass.
Runtime edits do not change Item probabilities The one-time probability-table build in Awake Configure weights before initialization or implement an explicit rebuild.
An empty Inventory Pickup appears Allow Empty Drops and the resolved source collection Disable Allow Empty Drops or add the intended rewards to ItemDrops.
Dropped Items still remain in the source Inventory Drop Copies was expected to transfer ownership Remove or clear source contents explicitly; Drop Copies controls unique Item cloning, not source removal.
Player Item Action duplicates the stack Remove On Drop Enable it and ensure the collection permits the full removal.
Gold varies much more than expected Min Offset and Max Offset were treated as percentages Enter multipliers such as 0.8 and 1.2 for an 80%-to-120% range.
Pickup is visible but cannot be collected Root pickup components, Interactable, Inventory Interactor, and layers Use the matching root component set and repair the interaction route.
Pickups appear one unit too high The Dropper’s fixed vertical offset Move the Drop Transform down or override DropOffset() for a different placement rule.
Auto-destroy removes only part of a non-pooled spawned object Whether Item Object Spawner created a pooled instance Use a pooled prefab or override cleanup; released Version 1 destroys only the Item Object component on its non-pooled cleanup path.

Developer reference

Call designer-configured droppers from the gameplay event that owns the reward:

public void HandleEnemyDefeated()
{
    m_RandomItemDropper.Drop();
    m_RandomCurrencyDropper.Drop();
}

Use the global Item Object Spawner when code provides the Item and exact world position:

var spawner = InventorySystemManager.GetGlobal<ItemObjectSpawner>(1);
var healthPotion = InventorySystemManager.CreateItem("Health Potion");
var pickupInfo = (ItemInfo)(1, healthPotion);

var pickup = spawner.Spawn(pickupInfo, transform.position);

ItemDropper.GetItemsToDrop() exposes the resolved fixed or random result before spawning. A custom dropper can modify mutable, unique Items and then call the protected DropItemsInternal method, as shown on the direct child page.

The built-in Dropper classes do not send a dedicated completion event. Observe the pickup’s success, fail, and partial UnityEvents for collection outcomes, or wrap Drop() in the project event that already knows why the reward was created.