Addon Lootbox v1.5
To create a LootboxItem, right-click inside any project folder, go to create and select LootBox/Lootbox Item.
Websocket Colyseus v1.5 for Lootbox - Download
1. Creating Lootbox Items (Unity)
To create a lootbox:
Create a currency that represents the box
Example:
STN= Stone BoxHERO= Hero BoxROYAL= Royal BoxGOLDEN= Golden Box
Configure it normally in your existing currency setup (Monetization / GameInstance).
Create the LootboxItem asset
Right-click in Project:
Create → Lootbox → Lootbox Item
Fill:
lootboxId
Unique ID.
For WebSocket backend, must match the JSON/server entry (e.g.
stn_box).
currencyId
The currency that represents this box (e.g.
STN).If player has
10 STN, they see 10 Stone Boxes available.
price
Cost per open (usually
1).
Chances
commonChance,uncommonChance,rareChance,epicChance,legendaryChance
Rarity pools (RarityItems)
Configure what can drop for each rarity:
Currency rewards
Icons
Frames
Inventory items
Used directly in Offline/Firebase and as source for the JSON export for WebSocket.

2. UI Setup (Unity)
Add the UILootboxMenu / UILootboxPanel to your Home scene
Drop the
UILootboxPanelprefab into your Canvas.Create a button to open/close this panel.
Assign references in
UILootboxPanelLootboxes
lootboxItems: add all createdLootboxItemassets.lootboxEntryPrefab: prefab for each line in the list.lootboxEntryContainer: where entries are instantiated.
Confirm Dialog
Set
confirmPanel, image, texts, Yes/No buttons.
Animation
animationRoot,closedIcon,openedIconrarityVisuals: one entry per rarity (Common / Uncommon / Rare / Epic / Legendary)Background (optional)
SFX (optional)
Shake + delay config
Reward Popup
rewardPopup,rewardIcon,rewardTitle,rewardAmount,rewardCloseButton
How it behaves
The list shows one entry per
LootboxItem.The amount uses
MonetizationManager.GetCurrency(box.currencyId).On click:
Opens confirm popup.
On confirm:
Calls
BackendManager.Service.Lootbox_OpenAsync(lootboxId).Plays animation based on returned rarity.
Shows popup with correct icon/title/amount.
Refreshes the list (so used box count updates).
WebSocket Backend (Colyseus) Setup
Use this if you want the server to be the absolute truth (recommended for production).
3.1 Exporting Lootboxes JSON
In Unity, use the lootbox button/exporter (or the flow you're already using with other data) to generate:
lootboxes.json
Place this file in the folder:
server/data/lootboxes.json
The content is generated from your LootboxItem + RarityItems.
4. Quick Setup Checklist
Para quem só quer colocar pra rodar:
Create currencies for each box type (STN, HERO, ROYAL, etc).
Create
LootboxItemassets:Set
lootboxId,currencyId,price, chances, pools.
Add
UILootboxPanelto the Home scene:Assign lootboxItems, prefabs, confirm dialog, animation, popup.
WebSocket backend?
Export
lootboxes.jsonfrom Unity.Copy to
/data/lootboxes.jsonon server.Make sure you’re using the server build with:
lootboxes.loader.tslootbox.service.tslootbox.route.tsand
app.config.tsmounting/auth/lootbox.
Last updated