Gemini (aka Bard) is a conversational generative artificial intelligence chatbot developed by Google, based on the PaLM 2 Large Language Model.

The setup process for Gemini is a bit more complicated than for ChatGPT, since Gemini is not a standalone service, but a part of Google Cloud, which needs to be configured as well. This is a one-time process that takes a few minutes.

Vertex AI is a platform that offers all AI services of Google Сloud under one roof. Among other things, it provides access to Gemini.

In the context of AI Toolbox we use “Gemini” to refer both to the chatbot and the Vertex AI service.


Setting up Gemini in AI Toolbox consists of the following steps:

  1. Set up a Google Cloud project.
  2. Configure access to Gemini from Unity.

Let’s go through these steps in detail.

Set up a Google Cloud project

First, you need to create a Google Cloud project and enable Vertex AI API. This is a one-time process that takes a few minutes. After that, you can use Gemini in any AI Toolbox project. If you already have a Google Cloud project, skip the first three steps.

  1. Go to Google Cloud and click Get started for free or Start free.
  2. Follow the instructions to specify a Google account and set up a billing account. You will need to provide a payment method, but you will not be charged anything unless you explicitly upgrade to a paid plan. You can find more information about the free plan here.
  3. Go to the Google Cloud Console and click on My First Project, which has been automatically created for you.
  4. Copy the Project ID from the Project info section. In Unity, open Project Settings > AI Toolbox and paste the ID into the Project ID field in the Google Gemini section.
  5. Enable Vertex AI API:
    1. Go to the APIs & Services page.
    2. Click Enable APIs and Services.
    3. Search for Vertex AI API, select it, and click Enable.

Configure access to Gemini

Now you need to set up access to the project from your Unity Editor.

  1. Install the Google Cloud SDK on your development machine. Follow the instructions for your operating system.
  2. Provide the SDK installation path in Unity
    • If you are using MacOS, open Project Settings > AI Toolbox and paste the Google Cloud SDK path into the SDK Path field in the Google Gemini section. If you are not sure what the path is, simply click Find SDK Path on the settings page.
    • If you are using Windows, skip this step.
  3. In Unity, open Project Settings > AI Toolbox and click Login Google Cloud SDK. This will open a browser window where you need to log into your Google account and grant access to the Google Cloud SDK.
  4. On the same Settings page, click Login Google Auth Library. This will open a browser window where you need to log into your Google account and grant access to the Google Auth Library, which is used to authenticate to the Google Cloud APIs.
  5. Click Get Access Token. This will automatically fill in the Access Token field.
    • Access tokens expire after 1 hour, at which point you will need to click Get Access Token again. You can also click Get Access Token to get a new token before the current one expires.
  6. Lastly, click Test connection. If everything is set up correctly, you will see a message with a greeting from Gemini.

Done! You can now use Gemini in your Unity project to generate scripts, explain code, chat with your AI assistant, etc. To do this, simply select Google Gemini in the Chatbot dropdown in the code generation window or the chat window.

AI Toolbox does not access or store your Google Cloud credentials or any other information about your Google account. The only information that is stored (in encrypted form) is the access token, which is used to authenticate to the Google Cloud APIs.

Google Gemini Models

Currently AI Toolbox offers two models for Google Gemini:

  • PaLM 2. PaLM 2 is the original Gemini model, succeeded by Gemini Pro.
  • Gemini Pro. A state of the art Google model. It is available for all Editor tasks, including code generation and freeform chat. In our tests Gemini produced outstanding results for Unity-related topics.

To select the model, open Project Settings > AI Toolbox and select the model in the Google Gemini section.

Google Gemini settings and guide

Google Gemini models menu

Comments