All actions and storage of user inventory data are controlled by this class.

  • Subscribe to an event

*You should subscribe to events in “OnEnable” and unsubscribe in “OnDisable” methods.

UserInventory.InventoryUpdated += OnInventoryUpdated;

UserInventory.SuccessSubtractVirtualCurrency += OnSuccessSubtractVC;
UserInventory.ErrorSubtractVirtualCurrency += OnErrorSubtractVC;

InventoryUpdated – inventory data is ready to use.

  • VIP status
bool hasVIPStatus = UserInventory.HasVIPStatus;

HasVIPStatus (bool) – returns the status of the user, whether there is a VIP or not.

  • Item Quantity

GetItemAmount – Returns the amount of a specific item in the user’s inventory by item id.

  • Amount of virtual currency

GetVirtualCurrencyAmount – returns the amount of virtual currency the user has. You can get it via string or enum, both options are given above.

  • Number of tickets for the main spin

GetSpinTicketAmount – returns the number of tickets to spin the main spin. It is possible to receive through enum.

  • Number of key fragments for chests

GetChestKeyFragmentAmount – returns the number of key fragments to open chests. It is possible to receive through enum.

  • Subtract virtual currency from user
UserInventory.SubtractVirtualCurrency("CO", 10);
UserInventory.SubtractVirtualCurrency(VirtualCurrencyID.CO, 5);

UserInventory.SuccessSubtractVirtualCurrency += OnSuccessSubtractVC;
UserInventory.ErrorSubtractVirtualCurrency += OnErrorSubtractVC;

SubtractVirtualCurrency – debits the user’s virtual currency. Can be called via string or enum, both options are given above.

SuccessSubtractVirtualCurrency – the virtual currency was successfully subtracted after calling the “SubtractVirtualCurrency” method.

ErrorSubtractVirtualCurrency – Failed to subtract virtual currency after calling “SubtractVirtualCurrency” method.

Powered by BetterDocs

Go to Top