You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Communicate with local LLMs in Unity using Ollama — in just two lines of code.
🚀 Overview
SimpleOllamaUnity is an Unity extension that lets you communicate with Ollama in just two lines of code!
It also works at runtime, so you can use it in your games!
You can easily configure the following for a quick start:
🤖 Model
📃 System prompt
🌐 Ollama URI
👀 Reasoning (optional — can be disabled)
📦 Installation
Download the latest .unitypackage file from the Releases page.
Drag & drop it into your Unity project window.
Unity will automatically compile the editor extension.
No additional setup required.
The Plugins folder includes several .dll files required for integration.
💻 Usage
varollama=newOllama(newOllamaConfig(modelName:"qwen2.5:3b",systemPrompt:"Your answer mustn't be more than 10 words"));varresponse=awaitollama.SendMessage(newOllamaRequest(userPrompt:"When was GitHub created?"));
Yes, that’s it — only two lines of code! 🎉
To use a custom server URI:
varollama=newOllama(newOllamaConfig(modelName:"qwen2.5:3b",systemPrompt:"Your answer mustn't be more than 10 words",uri:"https://my-custom-server.local:3000/api/process"));
You can also remove reasoning from models that can do it:
varresponse=awaitollama.SendMessage(newOllamaRequest(userPrompt:"When was GitHub created?",clearThinking:true));
This will remove all reasoning (from <think> to </think>).
🧪 Full Example:
usingUnityEngine;usingHardCodeDev.SimpleOllamaUnity;publicclassTest:MonoBehaviour{privateasyncvoidStart(){varollama=newOllamaBase(newOllamaConfig(modelName:"qwen2.5:3b",systemPrompt:"Your answer mustn't be more than 10 words"));varresponse=awaitollama.SendMessage(newOllamaRequest(userPrompt:"When was GitHub created?"));Debug.Log(response);// Prints LLM response to the console}}
🛠 TODO
Review which .dll files in the Plugins folder are actually required and remove the unnecessary ones.
📄 License
This project is licensed under the MIT License.
See the LICENSE file for full terms.