A plugin that allows Gemini to be used inside Unity. A free tool as an alternative to ChatGPT API.
MIT License
Currently, this plugin is only suported on versions of Unity 2021.x and above
This plugin is provided as a custom Unity package that you can import into any existing project with the Unity version 2021.x and above.
Once you've downloaded the Unity package, you can import the package into your scene through the Gemini_Manager_V2
prefab.
This plugin provides public functions to send a prompt, and receive a text reply from the Gemini API.
The focus here is to provide an alternative to ChatGPT.
To get started you will first need to fetch your Google API key, which can be found in your Google AI Studio account under Get API Key
(or through this direct link). Here, you can create a new secret key and copy the value (you will need to your secret key for the next step).
Inside the package, you will find a Gemini_Manager_2
prefab. Drag the prefab into your scene, and add your API Gemini Secret Key inside the JSONTemplate.json
. We recommend doing that, so you can git ignore your JSON file when working with github.
In the component bar you will see a JsonApi
option where you will attach the JSONTemplate.json
text Asset. When starting the script, it will set your API_Key, and send your prompt
, then you will receive an answer from the LLM at the beginning of the scene.
When you enter a prompt and send it, Unity will send the prompt to the Gemini API, then it will receive the response, and make a Debug.Log
of the reply.
Note that each time you send a prompt, a new chat request is sent to Gemini API.