GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - HardCodeDev777/SimpleOllamaUnity: Communicate in Unity(also at runtime) with LLMs via Ollama in just two lines of code

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
Demo
Demo
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Ollama Unity C# License Last commit Tag Top lang

πŸ¦™ SimpleOllamaUnity β€” Unity Extension

Listed in Ollama Community Integrations

Listed in ai-gamedev-tools

 

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

  1. Download the latest .unitypackage file from the Releases page.
  2. Drag & drop it into your Unity project window.
  3. Unity will automatically compile the editor extension.

No additional setup required.

The Plugins folder includes several .dll files required for integration.


πŸ’» Usage

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>).

   

πŸ§ͺ Full Example:

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
    }
}

πŸ“„ License

This project is licensed under the MIT License.
See the LICENSE file for full terms.

About

Communicate in Unity(also at runtime) with LLMs via Ollama in just two lines of code

Topics

ollamaollama-integrationunityunity-tool

Resources

Readme
MIT license
Activity

Stars

11 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Contributors

Languages

You are visitor 01402520 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.