Purpose: optional bridge component linking Shop and InventoryComponent. Listens to Shop.OnPurchasedId(itemId) and, for every match in its Mappings table, calls InventoryComponent.AddItemData(...) and fires OnGranted(data, amount).
Available since 8.5.0.
Putting _inventoryItem / _inventoryAmount directly on ShopItemData would close an asmdef cycle: Neo.Shop → Neo.Tools.Inventory → Neo.Tools.View → Neo.Tools.Components → Neo.Shop. Inverting the direction here (Neo.Tools.Inventory references Neo.Shop) removes the cycle. The user-facing UX is the same: drop a single component, configure mappings, done.
- Add
Shop Inventory Grant Bridge(Add Component > Neoxider > Tools/Inventory > ShopInventoryGrantBridge) on the same GameObject asShop(or any descendant). - Optionally assign
_shop(when null, the bridge searchesGetComponentInParent<Shop>()inAwake). - Assign
_inventoryor enable_useInventorySingletonto useInventoryComponent.Instance. - Fill
Mappings:Shop Item Id— stableShopItemData.Id.Inventory Item— matchingInventoryItemData.Amount— units granted per purchase (≥ 1).
When any mapped ShopItemData is purchased (directly or as part of a bundle — Shop raises OnPurchasedId for each item inside BuyBundle), the bridge looks up its mappings and grants the inventory.
| Field | Description |
|---|---|
_shop |
Source of events. When null — auto-found via GetComponentInParent<Shop>() at Awake. |
_inventory |
Target inventory. When null and _useInventorySingleton == true, falls back to InventoryComponent.Instance. |
_useInventorySingleton |
Singleton fallback toggle when _inventory is null. |
_mappings |
List of { Shop Item Id, Inventory Item, Amount }. |
OnGranted |
UnityEvent with arguments (InventoryItemData, int amountAdded). |
ShopInventoryGrantBridge bridge = ...;
bridge.SetShop(shop);
bridge.SetInventory(inventory);
bridge.GrantForShopItemId("sword_basic"); // NoCode-friendly UnityEvent target
bridge.GrantDirect(inventoryItemData, 3); // direct grant (DLC, code paths)
bridge.Mappings.Add(new ShopInventoryGrantBridge.GrantMapping {
ShopItemId = "season_pass_reward",
InventoryItem = chest,
Amount = 1
});