Installation and native SDKs
ZenTS supports both Git URL and embedded packages. Build and installation outputs live in the project; PackageCache does not need write access.
Bidirectional calls
Manage the script domain in one application entry point. Use module exports for C#βJS and CLR type objects for JSβC#. The example needs no per-type Wrap.
Call C# from JavaScript
from JavaScript
Call JavaScript from C#
JsAppDomain.GetFunction binds a module export to a closed C# delegate. The main-thread script domain controls calls and lifetime.
TypeScript workflow
TypeScript provides checking, CLR declarations, and source maps. ZenTS executes emitted JavaScript. Node is used for build tooling; its standard library is not embedded at runtime.
Overloads, signatures, and params
Use short names normally and full CLR signatures when an exact candidate is required. Short-name candidates freeze at binding; no runtime method-registration API exists.
ref, out, and in
The two calling directions use different representations. Do not copy C# out placeholders into JavaScript calls.
Value types, views, and copies
Value types copy by default; reference objects preserve CLR identity. JS variable assignment is not CLR struct address writeback.
Functions, delegates, and events
JS functions, CLR delegates, and member closures are distinct. Specify the delegate type and receiver, and manage subscriptions explicitly.
Arrays and bytes
CLR arrays default to identity-preserving wrappers, not JS Arrays. SZArrays and multidimensional arrays use CLR indices.
Generic types and methods
Close type and method generics separately. Editor reflection does not establish that a corresponding AOT instantiation exists.
Extension methods
Configured CLR static extension methods become instance candidates on the extended type. ZenTS does not scan all assemblies or treat arbitrary static functions as extensions.
Common zents utilities
zents is the shared script facade. Internal hooks, V8 handles, and WASM tokens are not business APIs.
Explicit marshaling policies
Use JsMarshalAs on legal CLR slots when default conversion is insufficient. A policy belongs to the CLR signature; it is not a tag that bypasses validation on arbitrary JS values.
Member aliases
JsAlias selects a stable short name at binding time. It does not change CLR identity or the original full-signature key.
Allocations and data transfer
Shared bridges, cached binding plans, and explicit policies reduce interop costs. Allocation depends on type, direction, engine, and call shape; not every call is allocation-free.
Editor and Player
Editor and Player share observable interop rules but execute CLR calls differently. Compare results, error categories, writeback, and lifetimes rather than engine-specific stack text.
Build and publish
Choose the CLR host and JS backend, then prepare matching artifacts. ZenTS supports Unity 2022.3.x and later LTS releases, plus Tuanjie based on 2022.3. See the platform matrix.
Debug V8 in the Editor
Windows/macOS Editors include V8 Inspector for JS and source-mapped TypeScript debugging over Chrome DevTools Protocol. It is disabled by default and absent from Player builds.
Troubleshooting
Record Unity/Tuanjie version, OS/CPU, backend, SDK fingerprint, and the first failure. Installation succeeding does not prove runtime tests passed.