Unity
Unity integration
Introduction
After the user purchases a Virtual Item, it is automatically added to the user's Inventory during the transaction process. It is possible also to add a virtual item to the user's inventory without going through the purchase process for non-NFT items.
Retrieving inventory items with Virtual Items data
The following method gets all inventory items for the currently logged in player.
using System.Collections.Generic;
using UnityEngine;
using RGN.Modules.Inventory;
public class InventoryExamples : MonoBehaviour
{
private async void GetUserInventory()
{
List<InventoryItemData> inventory = await InventoryModule.I.GetWithVirtualItemsDataForCurrentAppAsync();
foreach (var inventoryItem in inventory)
{
Debug.Log($"Virtual item id : {inventoryItem.virtualItemId}");
Debug.Log($"Virtual item name : {inventoryItem.virtualItem.name}");
}
}
}Add to inventory
Add to inventory can be use to add regular virtual items into the player inventory. NFT's cannot be added to the inventory with this function.
Set Properties
Get properties
Was this helpful?