Tencent /puerts
PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.
★ 6,260⑂ 869👁 89⑃ 702● 1,503▤ 81
6,260
stars
+0+2+44
869
forks
89
watchers
702
prs
1,503
issues
81
releases
–
discussions
README
!Logo
!Unity_Test
!Unreal_CI
!Nuget_Build
Unreal Releases
Unity Releases


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