Listed in Ollama Community Integrations
Β
π Analyze your Unity scripts using large language models directly from the Editor β powered by Ollama.
UnityCodeLama is a powerful editor extension for Unity that allows you to send your C# scripts and prompts to an LLM (e.g. Qwen, Gemini, Deepseek, etc.) via Ollama β without ever leaving the editor.
It's useful for:
- π Code explanations
- π Bug hunting
- β¨ Suggestions & improvements
- 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.
Open the tool from the Unity menu:
HardCodeDev β UnityCodeLama
Once opened, youβll see the following window:
| Setting | Description |
|---|---|
| Add script path | Adds a new object field in the window to select a script. |
| Script file | Drag & drop or select a .cs file to include. |
| Add script to prompt | Adds the selected script to the prompt queue. |
| Clear script list | Removes all scripts from the queue. |
| Setting | Description |
|---|---|
| Model name | Name of the Ollama model to use (e.g. qwen2.5:3b). |
| Clear | Removes <think> blocks from models that produce internal thoughts (for cleaner output). |
| Prompt profile | Selects the type of analysis to perform (Explain, Find bugs, Improve). |
| Setting | Description |
|---|---|
| Prompt | The custom message to send to the model (e.g. questions, requests). |
| Send to Ollama | Sends your prompt, script(s), and profile to Ollama. |
See How prompts are sent for more details.
| Setting | Description |
|---|---|
| Response | The LLM-generated reply (read-only). |
| Copy response | Copies the reply to your clipboard. |
| Clear response | Clears the response field. |
Note
This is an Editor-only tool. It works entirely within Unity Editor and doesn't affect runtime or builds.
Say you have a script like:
using UnityEngine;
namespace HardCodeDev.Examples
{
public class Test : MonoBehaviour
{
private int _count;
private void Count() => _count++;
}
}You write a prompt like:
I made this script in 10 seconds!
With profile "Explain", the full message sent to the model will be:
Explain what this code does.
I made this script in 10 seconds! Here's the script(s):
// Script starts
using UnityEngine;
namespace HardCodeDev.Examples
{
public class Test : MonoBehaviour
{
private int _count;
private void Count() => _count++;
}
}
// Script ends
var promptInstruction = _promptOptions[_selectedPromptIndex] switch
{
"Explain" => "Explain what this code does.",
"Find bugs" => "Find any bugs or potential issues in this code.",
"Improve" => "Suggest improvements to this code.",
_ => ""
};
var fullPrompt = $"{promptInstruction}
{_prompt} Here's the script(s): {scriptInfo}";The scripts are read using:
scriptInfo += ScriptReader.ReadScript(path);With ScriptReader defined as:
public static class ScriptReader
{
public static string ReadScript(string relativePath)
{
if (relativePath.StartsWith("/"))
relativePath = relativePath.Substring(1);
var fullPath = Path.Combine(Application.dataPath, relativePath);
var code = "\n// Script starts \n";
code += File.ReadAllText(fullPath);
code += "\n// Script ends \n";
return code;
}
}- Review which
.dllfiles in thePluginsfolder 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!

