Testing
Testing competitive games using Metamask Wallet
- Downlaod Metamask plugin to your browser (other than Firefox).
- Run the correctly setup game in your main Unity Instance as well as one clone. Press play and find the correct log:
- Unfold it to find the private key.
- Select
Add account or hardware wallet in Metamask
and import the private key generated by Unity.
An account created this way can be used both in WebGL builds and in the Unity Editor. Unity automatically logs us in (always to the same account for a given editor instance), while WebGL requires manual signing in using a Wallet.
If you already have a wallet account, you can set Unity Editor to use it (in StandaloneBrowserJsConfig
Scriptable Object Inspector view).
- Select the
Sepolia
test network.
Further informations in the article are currently relevant only to Duel based games (irrelevant for asynchronous games).
- Press
Import tokens
and paste the address of the test USDC Token:0xf158908549032149090D59EB86B7b38BD5D15621
- Having the token ready, copy the address (blue) and use this faucet to mine some Sepolia ETH. You'll need aroung
~0.02 SepoliaETH
. This is the required currency to pay for gas. - Go to the Player's Cockpit, log in using the new account, and claim test tokens.
Testing Duel games
The obtained accounts can be used both in WebGL builds and in the Unity Editor. Unity automatically logs us in (always to the same account for a given editor instance), while WebGL requires logging in to play competitive
(for currency) - without logging in, we are only guests
and cannot access this feature. A guest also cannot use JoinCode
(it is important that they cannot access competitive
rooms).
Before the first competitive
match, you must deposit Trust
, which can be done via the Increase
button in the top bar.
You can finally create rooms and test in production! The host (by default, the room creator, unless permissions are transferred) can change room parameters. The game will start when both players mark themselves as Ready
.
After the match, players return to the room and can play a rematch or change the room. In the Unity Editor, you can test interactions with Metamask using the asset Assets/_RoomsPackage/Menu/Data/Blockchain/StandaloneBrowserJsConfig.asset
.
For example, increasing the Signature Delay
allows for verification of transitional login stages (whether the screen dims and becomes locked, and the login button is highlighted with a loading indicator and appropriate tooltip next to it). Should Confirm Signatures
, on the other hand, defines whether Metamask operations (login, increasing Trust, marking Ready, etc.) should be accepted or rejected.