gamelet-ue-puerts-proxy
v1.1.2
Published
JS to UE C++ remote proxy bridge (NativeTransport + AsyncTransport)
Maintainers
Readme
gamelet-ue-puerts-proxy
JS to UE C++ remote proxy bridge — NativeTransport (in-process puerts) + AsyncTransport (cross-window W2P).
A transparent Proxy layer that lets TypeScript code call into Unreal Engine objects with the same code regardless of whether it's running inside the UE puerts JS environment or in a remote window forwarded through the W2P (Window-to-Puerts) dispatcher.
Install
npm install gamelet-ue-puerts-proxy
# or
yarn add gamelet-ue-puerts-proxyQuick start
import { UEProxy, setTransport, AsyncTransport } from 'gamelet-ue-puerts-proxy';
// 1. Pick a transport (one-time, app boot)
// NativeTransport is the default when you're inside puerts.
// AsyncTransport is for app windows talking to a remote FJsEnv.
setTransport(new AsyncTransport(/* W2P channel */));
// 2. Build a type proxy
const Actor = UEProxy.type<typeof UE.Actor>('Actor');
// 3. Construct, call methods, read/write properties — same code in both modes
const actor = await Actor.$await(/* ctor args */);
const loc = await actor.GetActorLocation();
await actor.SetActorHiddenInGame(true);
actor.$set('Tags', ['hero']);
// 4. Release when done
actor.$release();Core API
| API | Purpose |
| ------------------------- | ------------------------------------------------------- |
| UEProxy.type<T>(name) | Create a type proxy (static methods + constructor). |
| proxy.$await(...args) | Construct an object remotely; resolves to ObjectProxy. |
| await proxy.Method(...) | Call any UE method asynchronously. |
| proxy.$get(key) | Read a UE property. |
| proxy.$set(key, value) | Write a UE property. |
| proxy.$release() | Release the underlying UE reference. |
Transports
NativeTransport— direct in-process puerts call, zero serialization overhead.AsyncTransport— frames the call as a W2P request, dispatched to UE through the SDK.
import { setTransport, NativeTransport, AsyncTransport, getTransport } from 'gamelet-ue-puerts-proxy';
setTransport(new NativeTransport()); // running inside puerts
setTransport(new AsyncTransport(channel)); // running in an app window
const t = getTransport();Lifecycle
import { releaseAll, getActiveProxyCount, isReleased } from 'gamelet-ue-puerts-proxy';
console.log('live proxies:', getActiveProxyCount());
releaseAll(); // dispose every outstanding proxy (e.g. on window close)Debugging
import { enableUEProxyLog, setUEProxyVerbose } from 'gamelet-ue-puerts-proxy';
enableUEProxyLog(true);
setUEProxyVerbose(true);License
MIT
