Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

puerts

> 编程语言
Open source

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.

6.2K stars0 likes1 views
WebsiteGitHub

About

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.

Unreal Releases

Unity Releases

-blue.svg) -blue.svg)

Nuget Releases

跳转中文

WHAT is PuerTS?

PuerTS is a multi-language scripting solution for Unity/Unreal/DotNet.

  • Multi-Language Support (Unity 3.0 New!): JavaScript/TypeScript, Lua, and Python — use the language your team is most productive in, or even mix them in one project. (Unreal currently supports JavaScript/TypeScript only.)
  • Provides high-performance script runtimes with seamless C#/C++ interop.
  • TypeScript declaration generation for type-safe access to host engine APIs.

WHY should I use PuerTS?

  • Choose your language (Unity): PuerTS 3.0 introduces a unified ScriptEnv architecture — write game logic in TypeScript, Lua, or Python with a consistent C# bridging API. No more one-size-fits-all.
  • Massive ecosystem access: leverage npm, LuaRocks, or PyPI packages alongside professional game engines to accelerate development.
  • Type safety when you want it: TypeScript's static type checking significantly improves code robustness, while Lua and Python offer rapid prototyping flexibility.
  • High efficiency: full-engine, cross-platform reflection calls — zero boilerplate for C++/C# interop.
  • High performance: static wrapper generation for performance-critical paths, across all supported languages.
  • Talented WebGL Support: massive advantage in performance and dev efficiency, even faster than pure C# in some cases.

Quick Start (Unity)

All three languages share the same ScriptEnv API — just swap the Backend:

JavaScript / TypeScript

csharp
using Puerts;
using UnityEngine;

void Start() {
    var env = new ScriptEnv(new BackendV8());
    env.Eval(@"
        const Vector3 = CS.UnityEngine.Vector3;
        const Debug = CS.UnityEngine.Debug;
        let pos = new Vector3(1, 2, 3);
        Debug.Log('Hello from JS! pos = ' + pos);
    ");
    env.Dispose();
}

Lua

csharp
using Puerts;
using UnityEngine;

void Start() {
    var env = new ScriptEnv(new BackendLua());
    env.Eval(@"
        local CS = require('csharp')
        local Vector3 = CS.UnityEngine.Vector3
        local Debug = CS.UnityEngine.Debug
        local pos = Vector3(1, 2, 3)
        Debug.Log('Hello from Lua! pos = ' .. pos:ToString())
    ");
    env.Dispose();
}

Python

csharp
using Puerts;
using UnityEngine;

void Start() {
    var env = new ScriptEnv(new BackendPython());
    env.Eval(@"
exec('''
import UnityEngine.Vector3 as Vector3
import UnityEngine.Debug as Debug
pos = Vector3(1.0, 2.0, 3.0)
Debug.Log('Hello from Python! pos = ' + pos.ToString())
''')
");
    env.Dispose();
}

Three languages, one API surface. Each example creates a Vector3, then calls Debug.Log — real C# interop in just a few lines.

Puerts.AI (Unity Only)

Built on top of PuerTS, Puerts.AI brings AI capabilities directly into Unity — both in the Editor and at game runtime.

Unity Editor Assistant

Puerts.AI includes a ready-to-use Unity Editor Assistant that lets you control the Unity Editor with natural language. For example:

  • "Build a medieval castle scene using basic meshes" — AI creates GameObjects, adjusts Transforms, assigns materials
  • "Analyze puerts-related logs" — AI filters and summarizes logs intelligently
  • "Check for missing scripts in the current scene" — AI traverses all GameObjects and reports issues

Any C# API is callable — the AI generates scripts that run in the PuerTS environment with full access to UnityEngine.* and UnityEditor.*.

The Editor Assistant comes in two versions:

Agent Version (Built-in) MCP Version (External)
How it works Chat directly inside a Unity Editor window Connect from Cursor, Windsurf, Claude Desktop, or any MCP-compatible AI tool
Speed ⚡ Faster — no network round-trips Communicates via HTTP/SSE
Best for Scene building, inspections, quick prototyping Vibe coding workflows — AI edits code while controlling Unity to verify results

What makes Puerts MCP different from other Unity MCP solutions?

  • No separate process — the MCP server runs directly inside the Unity process, no extra services to launch
  • Single tool, on-demand builtins — instead of registering dozens of tools upfront, it exposes only one tool; builtin modules are loaded on demand, saving context tokens while remaining equally powerful
  • Extensible via builtins & skills — add new capabilities by dropping files into the resource directory, no code changes needed

Puerts.Agent Framework

The Editor Assistant above is built with Puerts.Agent — an open, extensible LLM Agent framework. But it's not just for the editor — agents can also run in game runtime, opening up gameplay possibilities:

  • Smart NPC Demo — Each NPC has its own LLM Agent instance and personality-driven system-prompt. NPCs generate truly dynamic dialogue based on player behavior and game state, sense their surroundings via C# APIs, and form personalized interactions through conversation memory. (SmartNPCDemo)
  • Maze Runner Demo — An AI that autonomously navigates a 3D maze by taking screenshots to observe the environment, reasoning about viable paths, executing movement commands, and verifying results — all powered by just two builtin modules and a system-prompt.(MazeRunnerDemo)

Build your own agent by creating a simple resource directory:

Resources/my-agent/
├── system-prompt.md.txt      # Who the AI is and how it behaves
├── skills/                   # Domain knowledge documents (loaded on demand)
└── builtins/                 # Executable helper modules

HOW can I start to use PuerTS

Documentation


FAQ

  • general faq
  • unreal faq
  • unity faq

How to Install

  • unreal
  • unity

Changelog

  • unreal
  • unity

Known issues

  • unreal
  • unity

Select Script Backend

PuerTS supports multiple script backends. For JavaScript/TypeScript, choose from V8, QuickJS, or Node.js. PuerTS 3.0 also adds Lua and Python as first-class backends.

JavaScript Backends

  • V8 (default): Generally excellent performance, moderate code size, only includes the implementation of the ECMAScript specification, does not include Node.js API or browser API.

  • QuickJS: Performance is not as good as V8, does not support debugging, but has a small code size, suitable for scenarios where code size is critical.

  • Node.js: Supports Node.js API (OpenSSL-related APIs are not supported on Unreal Engine's mobile platform), but has a larger code size.

JS Backend Node API Performance Code Size Debugging Notes
V8 ❌ ***** *** ✔️
QuickJS ❌ ** * ❌
Node.js ✔️ ***** ***** ✔️ OpenSSL may be disabled

Additional Language Backends (Unity 3.0 New!)

Note: Lua and Python backends are currently available for Unity only. Unreal Engine still supports JavaScript/TypeScript exclusively.

Backend Language Performance Platform Support Notes
Lua Lua 5.4 ***** All platforms Ideal for teams already using Lua
Python CPython *** Desktop only Great for AI/ML integration & tooling

Avaliable on these Engine

  • unreal engine 4.22 ~ latest

  • unity 5 ~ latest

  • Any .net project

Available on these Platform

PuerTS's core code supports all platforms supported by the game engines, but each script backend has its own platform requirements:

Windows Mac Linux Android iOS H5/Mini Games
V8 ✔️ ✔️ ✔️ ✔️ ✔️ ❌
Nodejs ✔️ ✔️ ✔️ ✔️ ✔️ ❌
Quickjs ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Webgl ❌ ❌ ❌ ❌ ❌ ✔️
Lua ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Python ✔️ ✔️ ✔️ ❌ ❌ ❌

Note 1: Only V8, Nodejs, and Quickjs backends are available for Unreal. Unity supports all backends listed above. Note 2: Although the Webgl backend only supports H5/Mini Games, its scripts run in the native JS VM of the web environment, which typically delivers higher performance (e.g., JIT support in iOS Mini Games). It also provides first-class language benefits such as convenient debugging and profiling. Note 3: For JavaScript, different platforms can use different JS backends — e.g., V8 for mobile apps and Webgl for H5 — achieving full platform coverage with optimal performance.

Ask for help

Github Discussion


WHAT - 普洱TS是什么?

PuerTS 是 Unity/Unreal/Dotnet 下的多语言脚本编程解决方案。

  • 多语言支持(Unity 3.0 新特性!):JavaScript/TypeScript、Lua、Python 三大语言开箱即用——团队擅长什么就用什么,同一个项目里甚至可以混用。(Unreal 目前仅支持 JavaScript/TypeScript。)
  • 提供高性能脚本运行时,与 C#/C++ 无缝互操作。
  • 提供 TypeScript 声明文件生成能力,类型安全地访问宿主引擎 API。

WHY - 为什么我该用普洱TS?

  • 自由选择语言(Unity):PuerTS 3.0 引入了统一的 ScriptEnv 架构——用 TypeScript、Lua 或 Python 编写游戏逻辑,享受一致的 C# 桥接 API,不再被某一种脚本语言绑定。
  • 海量生态随手可用:npm、LuaRocks、PyPI 的海量包 + 专业游戏引擎的渲染能力,加速开发效率。
  • 按需选择类型安全:TypeScript 的静态类型检查显著提升代码健壮性;Lua 和 Python 则提供快速原型验证的灵活性。
  • 高效:全引擎,全平台支持反射调用,无需额外步骤即可与宿主 C++/C# 通信。
  • 高性能:全引擎,全平台支持生成静态调用桥梁,所有支持的语言都兼顾了高性能场景。
  • WebGL 平台天生优势:相比其他脚本方案,PuerTS 在 WebGL 平台性能和效率上都有极大提升,极限情况甚至比纯 C# 更快。

快速上手(Unity)

三种语言共享同一套 ScriptEnv API,只需切换 Backend:

JavaScript / TypeScript

csharp
using Puerts;
using UnityEngine;

void Start() {
    var env = new ScriptEnv(new BackendV8());
    env.Eval(@"
        const Vector3 = CS.UnityEngine.Vector3;
        const Debug = CS.UnityEngine.Debug;
        let pos = new Vector3(1, 2, 3);
        Debug.Log('Hello from JS! pos = ' + pos);
    ");
    env.Dispose();
}

Lua

csharp
using Puerts;
using UnityEngine;

void Start() {
    var env = new ScriptEnv(new BackendLua());
    env.Eval(@"
        local CS = require('csharp')
        local Vector3 = CS.UnityEngine.Vector3
        local Debug = CS.UnityEngine.Debug
        local pos = Vector3(1, 2, 3)
        Debug.Log('Hello from Lua! pos = ' .. pos:ToString())
    ");
    env.Dispose();
}

Python

csharp
using Puerts;
using UnityEngine;

void Start() {
    var env = new ScriptEnv(new BackendPython());
    env.Eval(@"
exec('''
import UnityEngine.Vector3 as Vector3
import UnityEngine.Debug as Debug
pos = Vector3(1.0, 2.0, 3.0)
Debug.Log('Hello from Python! pos = ' + pos.ToString())
''')
");
    env.Dispose();
}

三种语言,同一套 API。每个示例都创建了一个 Vector3,然后调用 Debug.Log ——短短几行代码即可实现真正的 C# 互操作。

Puerts.AI(仅 Unity)

基于 PuerTS 构建的 Puerts.AI,将 AI 能力直接带入 Unity——无论是编辑器还是游戏运行时。

Unity 编辑器助手

Puerts.AI 内置了一个开箱即用的 Unity 编辑器助手,让你用自然语言操控 Unity 编辑器。例如:

  • "用基础 Mesh 搭建一座中世纪城堡场景" —— AI 自动创建 GameObject、调整 Transform、设置材质
  • "分析下 puerts 相关的日志" —— AI 智能过滤并总结日志
  • "检查当前场景有没有脚本丢失" —— AI 遍历所有 GameObject 并报告问题

凡是 C# 能调用的,AI 都能做到——AI 生成的脚本运行在 PuerTS 环境中,可直接访问 UnityEngine.* 和 UnityEditor.* 的完整 API。

编辑器助手有两个版本:

Agent 版(内置) MCP 版(外接)
使用方式 在 Unity 编辑器窗口内直接对话 从 Cursor、Windsurf、Claude Desktop 等支持 MCP 协议的 AI 工具接入
速度 ⚡ 更快——没有网络往返 通过 HTTP/SSE 通信
适合场景 场景搭建、日常检查、快速原型 Vibe coding 工作流——AI 一边改代码一边操控 Unity 验证效果

Puerts MCP 与市面上其他 Unity MCP 方案有何不同?

  • 无需额外启动进程 —— MCP Server 直接跑在 Unity 进程内,不用另起服务
  • 单工具 + 按需加载 builtin —— 不像其他方案预注册几十个工具,Puerts MCP 只暴露一个工具,builtin 模块按需加载,更省上下文 token,但功能同样强大
  • 通过 builtin 和 skill 机制拓展 —— 只需往资源目录里放文件就能添加新能力,无需改

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++dotnetjavascriptnodejsquickjs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言