Guides
How to Integrate Crossmint with Unity

Integrate NFTs into your Unity game in 3 steps

Walk through the process of setting up a Unity game utilizing Crossmint's Custodial Wallets and NFT Minting capabilities.

Share:
how-to-integrate-crossmint-and-unity

Crossmint offers a powerful set of APIs that enable developers to interact with the blockchain, especially NFTs. In this tutorial, we will walk you through the process of setting up a Unity demonstration utilizing Crossmint's Custodial Wallets and Minting abilities. By the end of this tutorial, you'll have a simple menu to showcase the potential of integrating Crossmint in your own personal game or project.

To see a demo of integrating Crossmint with Unity, watch the video below:

Prerequisites:

  • Basic knowledge of Unity and C#
  • Unity Editor version 2021.3.21f1 or later
  • Node.js installed on your machine

Step 1: Obtain Crossmint API Keys

  1. Go to staging.crossmint.com/console and create an account.
  2. Navigate to API keys and click on "New API Key".
  3. Check the nfts.mint, wallets.read, wallets.create, and wallets:nfts.read scopes.
  4. Save your new key and copy the CLIENT SECRET and Project ID values for later.

Step 2: Configure the middleware server

  1. Clone the unity-example project from the GitHub repository.
  2. Open the BackendServer project and rename the .env.template file to .env.
  3. Fill in the CROSSMINT_X_CLIENT_SECRET and CROSSMINT_X_PROJECT_ID fields in the .env file with the values obtained from the Crossmint console.
  4. Save the .env file.
  5. Open index.js and configure the authentication method based on the instructions presented on line 11.
  6. Start the server by running the following command in the BackendServer directory:

node index.js

Step 3: Configure Unity

  1. Open the project in the Unity Editor.
  2. Open the C# project by navigating to Assets -> Open C# Project.
  3. Open Config.cs and update the BackendServer URL.
  4. Ensure the BackendServer is running and start the game!

Now you have successfully set up a Unity demo utilizing Crossmint's Custodial Wallets and Minting abilities. This simple menu demonstrates the potential of integrating Crossmint in your own personal game or project. Feel free to explore and expand the project to better understand how Crossmint can improve your blockchain-related projects. For more ideas on using our tools, head to our docs.