You can listen for changes in the inventory system so that you can respond appropriately, such as updating the UI, by implementing the IObserver pattern, or use the SystemObserver<T> type which handles it for you.
1
2
3
4
5
vardisposer=SystemObserver<InventorySystem>.Create(inventorySystem,system=>{Instance.Logger.Info($"System updated.");// Update UI elements etc as necessary here...});
You can consume items or item instances for a user that have the consumable flag. You can specify whether or not the user is allowed to overconsume (use more than they have).
Setting overconsume to true can be useful when handling multiple device scenarios. This allows consumption of the item, even if the local device’s resource data is out of sync. However, once the item reaches zero, further consumption is prevented, irrespective of the overconsume setting. This provides developers flexibility in managing inventory inconsistencies across devices.