Model or dataset
undreamai/LLMUnity avatar
undreamai/LLMUnity

LLMUnity: Running llama.cpp Backends Inside a Unity Scene

Create characters in Unity with LLMs!

1,708 stars195 forksC#Apache-2.0

At a glance

What is it?
LLMUnity wraps a llama.cpp based backend in C# components so Unity developers can attach a chat or RAG character to a GameObject. It is a local-inference toolkit with a clear audience and a clear cost: the project ships the model runtime, so you own the download, the disk footprint and the platform build matrix.
Who is it for?
Adopt LLMUnity if you need character dialogue that runs without an internet connection and you accept shipping model weights alongside your build. Do not adopt it if you need a hosted, centrally updated model with no client-side footprint, or if your target platform is outside the documented set of desktop, mobile and VR builds.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 140 days ago.
What is it written in?
Mainly C#, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The problem LLMUnity solves: dialogue that does not leave the machine

Most ways of putting a conversational character into a Unity game involve a network call. The game sends player text to a server, waits, and renders the reply. That introduces latency you do not control, a per-request cost, a dependency on connectivity, and a privacy question about what the player typed. LLMUnity takes the opposite route. The README states that it runs locally without internet access and that no data leaves your game, and it also lists a remote server setup as a supported option. So the project is not anti-server; it is local-first with a remote escape hatch.

The audience is narrow but real. It is Unity developers building NPCs, chatbots or interview-style simulations who want the model on the player's machine. The README's own gallery of projects points in that direction: visual novels, dating simulators, VR mock interviews, a Meta Quest experience. These are genres where an NPC that answers in character is the product, not a feature bolted onto a shooter. If you are building a multiplayer action game and want a small text classifier, this is the wrong shape of tool.

How the pieces fit: LlamaLib under C# components in a scene

The architecture described in the README has three layers. At the bottom is llama.cpp, the C++ inference library. LLMUnity does not call it directly. Instead the project maintains LlamaLib, described as a standalone C++/C# library built on top of llama.cpp, and that is the LLM backend for the Unity package. Above that sits the Unity-facing C# layer: components you attach to GameObjects, plus a RAG system for semantic search.

That separation matters when you debug. A crash inside tokenisation or a model that fails to load is a LlamaLib problem, not a C# problem, and the fix will come from the backend repository rather than the Unity package. It also means the Unity package version and the LlamaLib version can drift apart, which is worth checking when you upgrade one but not the other.

The RAG layer is the other half of the design. The README describes it as a Retrieval-Augmented Generation system for semantic search across your data, used to enhance a character's knowledge, and the feature list specifies ANN search. So the flow is: your data is embedded and indexed, a player question retrieves the nearest entries, and those entries are injected into the prompt before generation. The README does not spell out the embedding model, the index format or the chunking strategy in the material available here, so treat those as things to confirm in the documentation before you design a content pipeline around them.

Getting it into a project: package, model, component

The README lists a Setup section and a Quick start section but the cleaned text does not include their commands, so the exact install steps are not reproducible from what is provided here. What can be stated from the material: the package is distributed both through the Unity Asset Store (the badge links to a specific package slug) and through the GitHub repository, and the README claims setup is easy and that you call it with a single line of code. That claim is the project's own wording, not a measurement.

The step that will actually cost you time is model management, and the README gives it a dedicated section heading. The package supports what it calls all major LLM models, which in a llama.cpp-based stack means GGUF weights. You choose the model, you host the file, and you decide how it reaches the player's device. The README also states that the backend supports CPU and GPU inference across Nvidia, AMD and Apple Metal, and that it is tested on Unity 2021 LTS, 2022 LTS, 2023 and Unity 6.

Those two facts together define your build matrix. Four Unity versions times three GPU vendors times desktop, mobile and VR is a lot of combinations, and the README does not present a per-combination compatibility table. Plan to test on your actual minimum-spec device rather than trusting the summary line.

Where it breaks down: model size, build size and platform reach

The central trade-off is that local inference moves cost from your server bill to the player's hardware. A model small enough to run on a mid-range phone is a model with limited reasoning ability and a short effective context. A model good enough for nuanced character dialogue is a multi-gigabyte download. The README does not quote any model sizes, memory figures or tokens-per-second numbers, so any specific figure you see elsewhere is not from this source.

This creates three concrete failure modes. First, a build that works on your development desktop can fail on a phone purely on memory. Second, the download step is now part of your onboarding: the player waits for weights before the character speaks, and you need a plan for interrupted downloads and for devices with little free storage. Third, GPU acceleration depends on the player's drivers and hardware, and the README lists supported vendors but not minimum GPU generations, so older integrated graphics are an open question.

There is also a scope limitation. The README describes the Unity package as targeting PC, mobile and VR. Consoles are not mentioned. If your ship target includes a console, the local-inference model is not the path the documentation describes, and you would be looking at the remote server option instead, which brings back the connectivity and cost problems the local mode was meant to avoid.

The alternative: a hosted LLM API behind a thin C# client

The obvious alternative is to skip the local runtime entirely and call a hosted model from Unity over HTTPS. The difference is not just where the compute happens, it is what you own. With a hosted API, model choice and quality improve without you shipping a new build, the client binary stays small, and there is no per-device memory ceiling. In exchange, every line of dialogue costs money and requires a network round trip, you inherit the provider's latency and rate limits, and player text leaves the device.

LLMUnity's remote server option sits between the two: the same C# components and the same RAG system, but pointed at a server you run. That is a reasonable middle path for a studio that wants one code path across a phone build and a PC build with different compute budgets. The README presents it as a supported configuration rather than a fallback, which is a fair reading of the design.

A second alternative worth naming is using llama.cpp directly from C# without the Unity wrapper. You would get the same inference engine and lose the GameObject components, the RAG layer and the Unity version testing. For a team already comfortable with native interop and P/Invoke, that is a real option; for a team that wants to drop a character into a scene and move on, it is more work for less.

Maintenance, versioning and what the licence does and does not cover

The release cadence visible in the material is steady: v3.0.1 in January 2026, v3.0.2 in February, v3.0.3 in March, with the last push to main in April 2026. A three-release run inside one minor version suggests active patching rather than a frozen library, and it means you should pin a version and read the release notes before moving. The README also links to an upcoming releases project board, which implies planned breaking work rather than a maintenance-only mode.

Upgrade cost has two parts. The Unity package upgrades through the normal package route, but the underlying LlamaLib backend is a separate repository, and a new Unity package version may expect a matching backend build. Budget time for testing both together, and for re-validating your model files against the newer backend, since llama.cpp side changes can affect GGUF compatibility.

The licence is Apache-2.0, which is a permissive licence with an explicit patent grant and a requirement to preserve notices and state changes. The README also states the package is free to use for personal and commercial purposes. That is the project's own statement; it is not legal advice, and it does not address the licences of the model weights you download. Those weights carry their own terms, and a model licensed for research only would not become commercially usable because the wrapper is Apache-2.0. Check the model card before you ship.

Who should adopt LLMUnity, and what to check first

Adopt it if your game's value comes from characters that talk, your target platforms are desktop, mobile or VR, and you have a reason to keep inference on the player's machine: offline play, privacy, no per-message cost, or a publisher who will not sign off on a recurring API bill. The RAG system is the part that makes this more than a chat wrapper, since it lets a character answer from your own lore or documentation rather than from the base model's training data.

Do not adopt it if you need a console build, if you cannot ship model weights to players, or if your dialogue quality bar requires a frontier model that will not fit on a phone. In those cases the hosted API route is the honest choice, and LLMUnity's remote server mode is only worth it if you specifically want the Unity component layer and the RAG pipeline in front of your own endpoint.

Before you commit, verify three things against the current documentation rather than this summary. Confirm the exact install path and the model management workflow, since the README sections covering them were not available in full here. Confirm that your chosen model fits the memory budget of your lowest-spec target device with room for the game itself. And confirm that the LlamaLib release matching your package version supports your target platform's GPU path, because the README lists vendors but not minimum hardware generations.

Editorial conclusion

Adopt LLMUnity if you need character dialogue that runs without an internet connection and you accept shipping model weights alongside your build. Do not adopt it if you need a hosted, centrally updated model with no client-side footprint, or if your target platform is outside the documented set of desktop, mobile and VR builds. Before committing, verify that your chosen GGUF model actually fits your minimum-spec device's memory budget, and confirm the current LlamaLib release notes for your target platform.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. undreamai/LLMUnity on GitHub
Community notes

Community notes