Unity 2021.3 or later. The source and releases are at github.com/Gamavas/pass-unity (MIT).
Install
1
Add the package
In Unity, open Window → Package Manager → + → Add package from git URL… and enter:Or add it to
Packages/manifest.json:Packages/manifest.json
2
Connect your game
At developer.gamavas.fun, connect your game listing to get a client ID. It’s public, so it’s fine in your build.Under Where sign-in returns, add an address for each platform you ship:
3
Start the SDK
Call
Init once, as early as you can:Login.cs
Sign players in
The quickest way is the GamavasSignInButton component: add it to any UI element and listen to its On Signed In event. It needs an EventSystem in the scene, like any UI button. The component starts the sign-in on press, not on release. That matters on WebGL: browsers only open popups during a click, so the popup opens on that same click. To use your own button, callSignInAsync from its click handler:
player.id is the player’s Gamavas ID: the same in every game, so it’s the one to store. Pass askForEmail: true to also ask for their email. They can decline, and then player.email is null.
To sign the player out of your game (not of Gamavas), call await GamavasPass.SignOutAsync().
Achievements and XP
Add achievements to your app in the developer portal, then unlock them from your game:newlyUnlocked is false and no XP is added. On WebGL, Gamavas shows an “Achievement unlocked” notice; pass notify: false to show your own. On desktop and mobile, show your own.
Achievements marked server in the portal can’t be unlocked from the game, so a modified client can’t grant them. Unlock them from your server.
Sell your game
Set a price on your app’s Store page in the developer portal, then gate your game on ownership:PurchaseAsync from a click. On desktop and mobile it opens the browser and checks every few seconds until the game is owned, for up to 15 minutes.
To try this without paying, turn on test mode: new GamavasPassOptions { Test = true }. The checkout then offers a free Complete test purchase button, for you and the testers you add on the Store page. Turn it off before you ship.
Platforms
- WebGL
- Desktop
- Mobile
Add the Gamavas script to your WebGL template’s The SDK loads the script itself if it’s missing. In the
<head> (or the built index.html):<head>, though, the sign-in popup can close before Unity starts loading in it.Mobile
1
Register the link
In the developer portal, under Where sign-in returns, add your bundle ID in lower case, then
:/pass. You’ll find the bundle ID in Player Settings → Other Settings → Package Name / Bundle Identifier.A bundle ID with an underscore can’t be a link. In that case, choose your own: a reverse domain name you own, with one slash.2
iOS: add the URL scheme
In Player Settings → Other Settings → Supported URL schemes, add the part before the colon, for example
com.studio.game.3
Android: add an intent filter
Turn on Custom Main Manifest in Player Settings → Publishing Settings. Then, in
Assets/Plugins/Android/AndroidManifest.xml, add this inside the <activity> that has the LAUNCHER intent filter:AndroidManifest.xml
The player comes back without finishing
The player comes back without finishing
SignInAsync fails with code cancelled about 2 seconds after the game is back in front, so your button doesn’t stay stuck. If they then finish in the browser after all, the link still signs them in and PlayerChanged fires.The phone closed the game during sign-in
The phone closed the game during sign-in
The sign-in is saved before the browser opens. When the link starts the game again, the SDK finishes it.
await GamavasPass.Ready after Init if your first scene needs to know who’s signed in.Your server
If your game has a server, never trust a player ID the game sends. Send the player’s access token instead, and let your server ask Gamavas who it belongs to:@gamavas/pass-server checks it with your secret key:
server.ts
Options
Errors
Every failure throws aGamavasPassException with a Code and Gamavas’s explanation in Message:

