Skip to main content
Version: v2

2. Register the game

💡Info
The complete code for this step can be found in the branch named step_02.

Register the game

To easily onboard players onto Immutable Runner, you can use Immutable Passport for authentication and a web3 wallet. However, you must register the game in the Immutable Hub before using Passport.

  1. Go to the Immutable Hub and follow the instructions to log in.
  2. Once logged in, in the Projects tab, click Add Project.
  3. Enter the project's name, select Immutable zkEVM and click Save.
Hub create project
  1. Enter the environment's name, select Testnet and click Save.
⚠️Warning
Make sure to select the Mainnet environment when launching your game on the mainnet.
Hub create environment
  1. In the Passport tab, click Add Client.
Hub Passport tab new project
  1. Choose Native (e.g. Mobile App, Desktop Game) as the Application Type and Game as the Sub Type.
  2. Enter the game's name in the Application Name field.
  3. Enter the game's redirect and logout URLs in the Redirect URLs and Logout URLs fields so users are automatically returned to your game after login and logout.
Hub create Passport client
  1. Leave the Web Origins URL blank, as it’s not required for Unity games.
  2. Click Save Changes.
  3. When you return to Passport Configuration, you will find a Passport client and Client ID ready for integration into the game.
Hub Passport configuration

To learn more about each field, please refer to this link.

Initialise Passport

Now, you can use the Passport client to initialise Passport in the game. You will add Passport initialisation to the main menu screen.

Assets/Shared/Scripts/UI/MainMenu.cs

using Immutable.Passport;

namespace HyperCasual.Runner
{
public class MainMenu : View
{
Passport passport;

async void OnEnable()
{
ShowLoading(true);
m_StartButton.AddListener(OnStartButtonClick);

// Initialise Passport
string clientId = "YOUR_IMMUTABLE_CLIENT_ID";
string environment = Immutable.Passport.Model.Environment.SANDBOX;
string redirectUri = "immutablerunner://callback";
string logoutUri = "immutablerunner://logout";
passport = await Passport.Init(clientId, environment, redirectUri, logoutUri);

ShowLoading(false);
ShowStartButton(true);
}
}
}

Replace YOUR_IMMUTABLE_CLIENT_ID with the Client ID you obtained from the Immutable Hub.