Virtual items are game items, that can be purchased using game currency or can be rewarded as completing an Achievements. The Virtual item can also be minted an turn into NFT through the PLAY Dev Dashboard.
For example, a virtual item can be:
Racing Game: It can be different types of cars.
Puzzle game: It can be a bunch of hints pack.
Match-3 game: There can be different types of power-ups.
Shooting Game: Different types of guns, ammo etc
Virtual Items can be added using the PLAY Dev Dashboard. In order to retrieve your list of virtual items you can use the following API.
Unity
Unity integration
Introduction
Virtual items are game items, that can be purchased using game currency or can be rewarded as completing an Achievements. The Virtual item can also be minted an turn into NFT through the PLAY Dev Dashboard.
For example, a virtual item can be:
Racing Game: It can be different types of cars.
Puzzle game: It can be a bunch of hints pack.
Match-3 game: There can be different types of power-ups.
description (string): Description of the virtual item.
appIds (List<string>): List of project id where your item can be accessed.
createdAt (long): Date and time of the item creation.
updatedAt (long): Date and time of the last update on the item.
createdBy (string): User ID of the creator of the item
updatedBy (string): User ID of the last person who updated the item.
isStackable (bool): Indicate if the item can be stored under the same ID in the inventory.
tags (List<string>): List of tags to filter the items.
properties (List<Property>): List of properties you can store in json format to retrieve with the virtual item.
prices (List<PriceInfo>): List of prices defined for this item. Used to process transaction with the user's currencies.
Virtual item class methods
IsNFT();
Return a bool to let you know if the virtual item is an NFT or not.
GetRGNCoinPrice();
Return the price in rgn-coin if the item is an NFT.
GetCustomCoinPrice(string currencyName);
Return the price based on your custom currency setup in the virtual item.
Get All Virtual Items for current app
usingSystem.Collections.Generic;usingUnityEngine;usingRGN.Modules.VirtualItems;publicclassVirtualItemExamples:MonoBehaviour{publicasyncvoidGetAllVirtualItem() {List<VirtualItem> virtualItems =awaitVirtualItemsModule.I.GetVirtualItemsAsync();foreach (var virtualItem in virtualItems) {Debug.Log($"Virtual item id : {virtualItem.id} \n"+$"virtual item name : {virtualItem.name}"); // etc } }}
Get with pagination
There is also a method overload for pagination requests. The pagination means you request not all items at once for the project. In this example every request contains 5 items. Each time you call the method, 5 more items will be loaded and added to the loaded item list.
usingSystem.Collections.Generic;usingUnityEngine;usingRGN.Modules.VirtualItems;publicclassVirtualItemExamples:MonoBehaviour{privateList<VirtualItem> allLoadedItems =newList<VirtualItem>();privateVirtualItem lastLoadedItem =null;publicasyncvoidGetVirtualItemsPaginationAsync() {List<VirtualItem> virtualItems =newList<VirtualItem>();if (allLoadedItems.Count>0) { lastLoadedItem =allLoadedItems[allLoadedItems.Count-1]; virtualItems =awaitVirtualItemsModule.I.GetVirtualItemsAsync(5,lastLoadedItem.id); // Get 5 more items }else { virtualItems =awaitVirtualItemsModule.I.GetVirtualItemsAsync(5,""); // Get 5 first items }allLoadedItems.AddRange(virtualItems);Debug.Log(allLoadedItems.Count); }}
It is possible the store and retrieve custom properties json string associated with virtual item. The json string should be UTF8 formatted string not longer than 100k characters.
To buy virtual items, please refer to the Store Module.
Unreal
Unreal integration
Introduction
Virtual items are game items, that can be purchased using game currency or can be rewarded as completing an Achievements. The Virtual item can also be minted an turn into NFT through the PLAY Dev Dashboard.
For example, a virtual item can be:
Racing Game: It can be different types of cars.
Puzzle game: It can be a bunch of hints pack.
Match-3 game: There can be different types of power-ups.