{"id":15064274,"url":"https://github.com/unitygamestudio/gemini-unity-package","last_synced_at":"2025-07-16T02:40:56.676Z","repository":{"id":257025872,"uuid":"851302093","full_name":"UnityGameStudio/Gemini-Unity-Package","owner":"UnityGameStudio","description":"A plugin that allows Gemini to be used inside Unity.  A free tool as an alternative to ChatGPT API.","archived":false,"fork":false,"pushed_at":"2025-04-04T17:34:48.000Z","size":286,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T18:23:14.840Z","etag":null,"topics":["chatgpt","gemini","gemini-api","unity","unity3d-plugin"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UnityGameStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-02T20:40:04.000Z","updated_at":"2025-04-04T17:16:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"3666992a-313d-4027-97f2-c8862ec99869","html_url":"https://github.com/UnityGameStudio/Gemini-Unity-Package","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"96ee24924999d93fa033a45b61ac06b87ff0e474"},"previous_names":["unitygamestudio/gemini-unity-package"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnityGameStudio%2FGemini-Unity-Package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnityGameStudio%2FGemini-Unity-Package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnityGameStudio%2FGemini-Unity-Package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnityGameStudio%2FGemini-Unity-Package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UnityGameStudio","download_url":"https://codeload.github.com/UnityGameStudio/Gemini-Unity-Package/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215192,"owners_count":21066619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","gemini","gemini-api","unity","unity3d-plugin"],"created_at":"2024-09-25T00:14:37.520Z","updated_at":"2025-07-16T02:40:56.409Z","avatar_url":"https://github.com/UnityGameStudio.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gemini-Unity-Package\n\u003e Currently, this plugin is only suported on versions of Unity 2021.x and above\n\n# Installation\n\nThis plugin is provided as a custom Unity package that you can import into any existing project with the Unity version 2021.x and above.\n\nOnce you've downloaded the Unity package, you can import the package into your scene through the `Gemini_Manager_V3` prefab. \n\n---\n\n# Setup\n\nGemini provides an alternative to ChatGPT for Unity developers. Here's a quick guide to setting up the latest release (V3) and previous release (V2):\n\n- **V3 Setup Guide (Latest Release)**: [Watch the YouTube tutorial](https://www.youtube.com/watch?v=J-6bymbjT_M\u0026ab_channel=UnityGameStudio)\n- **V2 Setup Guide (Previous Release)**: [Watch the YouTube tutorial](https://www.youtube.com/watch?v=Z6MFqIzOHK0\u0026ab_channel=UnityGameStudio)\n\n\n### Step 1: Login to your Google account and copy your secret key\nTo 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](https://aistudio.google.com/app/apikey)). Here, you can create a new secret key and copy the value (you will need to your secret key for the next step).\n\n![](/Images/ScreenShot4.JPG)\n\n### Step 2: Open the Unity Editor, configure the package, and start using Gemini\nInside the package, you will find a `GeminiManager` 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. \n\n![](/Images/NewUI.JPG)\n\nIn 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.\n\n![](/Images/ScreenShot8.JPG)\n\n\n# Functions\n\nThis plugin provides two public functions. One function to send a prompt, and receive a text reply from the Gemini API. And another function to send a chat history, and receive a reply from the Gemini API based on the chat. \n\nPrompt Function: \n\nThe script contains an IEnumerator function that sends your prompt to the Gemini API and prints the response to the console by calling Debug.Log().\n\n`private IEnumerator SendPromptRequestToGemini(string promptText)`\n\nChatbot Function:\n\nThe script contains an IEnumerator function that stores the user and Gemini responses, then sends the chat history to the Gemini API and prints the response to the console by calling Debug.Log().\nThere is a sample scene called `Chatbot` in the `Example` folder.  \n\nThe chatbot function now possess a `Bot Instructions` field, where you can add a behaviour, a knowdlege base or a background story to your chatbot.\n\n![](/Images/BotInstruction.JPG)\n\n`private IEnumerator SendChatRequestToGemini(string newMessage)`\n\n![](/Images/ChatbotScene.JPG)\n\nImage Prompt Function: \n\nThe script contains an IEnumerator function that sends your prompt to the Gemini API `gemini-2.0-flash-exp-image-generation`, then it receives a generated image, and saves it inside your device.\nThere is a sample scene called `SkyGeneration` in the `Example` folder.  \n\n`private IEnumerator SendPromptRequestToGeminiImageGenerator(string promptText)`\n\n![](/Images/SkyScene.JPG)\n\nMultimodal Prompt Function:\n\nThe script contains an IEnumerator function that reads a Media File through its File Path, then sends the bytes to the Gemini API along with your prompt. After, it prints the response to the console by calling Debug.Log().\n\nThere is a `Media` folder with sample files inside the `Example` folder. \n\n`private IEnumerator SendPromptMediaRequestToGemini(string promptText, string mediaPath)`\n\n![](/Images/MediaFile.JPG)\n\n# Usage\nThe unity package was made to directly use the prompt function. When you enter a prompt and send it (click on play), Unity will send the prompt to the Gemini API, then it will receive the response, and make a `Debug.Log` of the reply.\n\n\u003e Note that each time you send a prompt, a new chat request is sent to Gemini API. If you want to keep a chat history, I recommend using the `SendChatRequestToGemini(string newMessage)` function instead.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitygamestudio%2Fgemini-unity-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funitygamestudio%2Fgemini-unity-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funitygamestudio%2Fgemini-unity-package/lists"}