Skip to main content

Introducing ZenTS

ZenTS is a JavaScript/TypeScript scripting solution for Unity and Tuanjie. It follows ZLua's CLR interop design, with adaptations for JavaScript's this, undefined, BigInt, modules, and garbage collection.

Execution model​

EnvironmentCLR hostJavaScript engine
Windows/macOS EditorMono + Expression EmitNative V8
Win64/macOS/Android PlayerIL2CPP + C++ interop coreStatically linked V8
iOS PlayerIL2CPP + C++ interop coreJITless V8
WebGL/WeChat Mini GamesIL2CPP/WASMPlatform JS VM through HostJs

QuickJS has been removed, with no fallback. V8 is built from unmodified official sources as a static SDK, then linked into the adapters and Editor plugins. ZenTS does not embed Node.js. See platform compatibility and implementation status for supported configurations and validation limits.

Main capabilities​

  • CSharp[assembly][fullName] and csharp: modules bind CLR types on demand, without a developer-maintained per-type Wrap allowlist.
  • JsAppDomain.GetFunction<T> calls JS from C#. Constructors, methods, generics, aliases, and extensions follow explicit matching rules.
  • Interop covers structs, Nullable, arrays, delegates, events, ref/in/out, and explicit marshaling policies. Int64/UInt64 default to number; exact integer slots can opt into JsMarshalType.BigInt.
  • HostJs shares the CLR binding and marshaling core while running scripts in the platform VM. Module factories are produced at build time.
  • Git URL installation, read-only PackageCache, project-local SDKs, TypeScript declarations and emit, and Editor V8 Inspector are integrated.

Lazy binding still requires setup: Players need IL2CPP integration, generated configuration, AOT preservation, and the appropriate platform SDK.

Start with installation and the quick start. The specification defines behavior; design tradeoffs and testing explain evaluation and validation.