开源项目解析
LLM for Unity
把大模型集成进 Unity,做能对话的 AI 角色。包含一套检索增强系统,可以在你自己的资料上做语义检索,给角色补背景知识。
模型跑在玩家机器上自带检索增强底座是 llama.cpp
读懂层
2 张 · 架构图 / 时序图
DeepWiki · 抓取 2026-08-17 · 核验 2026-08-17
DeepWiki · 抓取 2026-08-17 · 核验 2026-08-17
它管哪几个决定
NPC 行为与对白本地大模型 / 强化学习
自持能力
动手层
文档代码结构踩过的坑实测 未做
装它要过哪几关
- 1从 Unity 资源商店或仓库装资源商店那条路更省事
- 2选一个模型模型大小直接决定玩家机器的内存占用。这是发行前最要紧的一个决定
- 3要用检索增强的话,把设定文档喂进去角色能引用你写的设定,靠的是这一步
改哪个文件能改什么
LlamaLib 后端基于 llama.cpp 的独立 C++/C# 库,模型格式与量化跟着它走坑在哪一处
带 issue 编号的来自:github issues 按回复数排序 · 核验 2026-08-17
玩家机器推理成本转嫁给玩家。低配设备会卡,这不是优化问题是架构选择
模型加载issue #402(8 条回复):某些新模型加载失败 —— 支持哪些模型跟着后端版本走,不是想用什么都行
多模态issue #134(8 条回复)在问图像输入,还没有
语音issue #44(16 条回复,最热)在要文字转语音与语音转文字。光有对话没有声音,NPC 体验是半截的
教程
官方文档、作者本人的视频,以及 ComfyUI 官方给的原生工作流示例。每条都验过还打得开。
项目自述
以下是仓库 README 的开头部分(原文引用,抓取 2026-08-17)。读全文 ↗
Create characters in Unity with LLMs! LLM for Unity enables seamless integration of Large Language Models (LLMs) within the Unity engine. It allows to create intelligent AI characters that players can interact with for an immersive experience. The package includes a Retrieval-Augmented Generation (RAG) system for semantic search across your data, which can be used to enhance the character's knowledge. The LLM backend, LlamaLib, is built on top of the awesome llama.cpp library and provided as a standalone C++/C# library. At a glance • How to help • Games / Projects using LLM for Unity • Setup • Quick start • Advanced usage • RAG • LLM model management • Examples • License At a glance - 💻 Runs anywhere: PC, mobile or VR! - ⚡ Blazing fast inference on CPU and GPU (Nvidia, AMD, Apple Metal) - 🏠 Runs locally without internet access. No data ever leave your game! - 📡 Supports remote server setup - 🤗 Supports all major LLM models - 🔍 Advanced RAG System (ANN search) - 🔧 Easy to setup, call with a single line of code - 💰 Free to use for both personal and commercial purposes 🧪 Tested on Unity: 2021 LTS, 2022 LTS, 2023, Unity 6 🚦 Upcoming Releases Business inquiries For business inquiries you can reach out at hello@undream.ai. How to help - ⭐ Star the repo, leave a review and spread the word about the project! - Join us at Discord and say hi. - Contribute by submitting feature requests, bugs or even your own PR. - this work or buy me a to allow even cooler features! Games / Projects using LLM for Unity - Verbal Verdict - I, Chatbot: AISYLUM - Nameless Souls of the Void - Murder in Aisle 4 - Finicky Food Delivery AI - AI Emotional Girlfriend - Case Closed - MaiMai AI Agent System - Claria Chat - Endless Casual Drive - Dating App Simulator - Virtual Reality Mock Interview - Velesio AI server - Dungeon Chat - Tomonaka Desk - Digital Humans - CakeMix - HeyWaifu - Love and Lie - Psycho Simulator - False Flame - CielChan: Anime Desktop AI Companion Contact hello@undream.ai to add your project! Setup _Method 1: Install using the asset store_ - Open the LLM for Unity asset page and click Add to My Assets - Open the Package Manager in Unity: Window > Package Manager - Select the Packages: My Assets option from the drop-down - Select the LLM for Unity package, click Download and then Import _Method 2: Install using the GitHub repo:_ - Open the Package Manager in Unity: Window > Package Manager - Click the + button and select Add package from git URL - Use the repository URL https://github.com/undreamai/LLMUnity.git and click Add Quick start 1. Setup the LLM First you will setup the LLM for your game: - Create an empty GameObject.In the GameObject Inspector click Add Component and select the LLM script. - Download one of the default models with the Download Model button (~GBs).Or load your own .gguf model with the Load model button (see LLM model management). 2. Create an AI Character Then you can setup each of your characters as follows: - Create an empty GameObject for the character.I ……(后略,见原文)
判断
优势
- 本地推理,发行后没有按次成本,也不怕接口变更
- 检索增强让角色能引用你写的设定,不是空口胡编
- 已上 Unity 资源商店,装配路径成熟
局限
- 推理成本转嫁给玩家的机器,低配设备会卡
- 模型越小越傻,够聪明的模型对玩家内存要求不低
- 只服务 Unity
不适用
面向低配移动设备的游戏 —— 本地推理这条路在那儿走不通。
同管这些决定的其它项目
github README + DeepWiki · 核验 2026-10-19 | 判断栏可报错。