Listed in Ollama Community Integrations
Communicate with local LLMs in Unity using Ollama — in just two lines of code.
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)
- 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.
var ollama = new Ollama(new OllamaConfig(
modelName: "qwen2.5:3b",
systemPrompt: "Your answer mustn't be more than 10 words"
));
var response = await ollama.SendMessage(new OllamaRequest(
userPrompt: "When was GitHub created?"
));
Yes, that’s it — only two lines of code! 🎉
To use a custom server URI:
var ollama = new Ollama(new OllamaConfig(
modelName: "qwen2.5:3b",
systemPrompt: "Your answer mustn't be more than 10 words",
uri: "http://my-custom-server.local:3000/api/process"
));
You can also remove reasoning from models that can do it:
var response = await ollama.SendMessage(new OllamaRequest(
userPrompt: "When was GitHub created?",
clearThinking: true
));
This will remove all reasoning (from <think>
to </think>
).
using UnityEngine;
using HardCodeDev.SimpleOllamaUnity;
public class Test : MonoBehaviour
{
private async void Start()
{
var ollama = new OllamaBase(new OllamaConfig(
modelName: "qwen2.5:3b",
systemPrompt: "Your answer mustn't be more than 10 words"
));
var response = await ollama.SendMessage(new OllamaRequest(
userPrompt: "When was GitHub created?"
));
Debug.Log(response); // Prints LLM response to the console
}
}
- Review which
.dll
files in thePlugins
folder are actually required and remove the unnecessary ones.
This project is licensed under the MIT License.
See the LICENSE file for full terms.
HardCodeDev
💬 Got feedback, found a bug, or want to contribute? Open an issue or fork the repo on GitHub!