Releases: forestlii/NativeRelay
Releases · forestlii/NativeRelay
Release list
v0.2.0 — pure-code contract + platform dispatch
Breaking redesign of the request/result contract, plus platform dispatch and an iOS channel.
Changed (breaking)
- Pure-code string contract:
Bridge.Request(int command, string payload, Action<int code, string data> onResult).INativeChannel=Send(long seed, int command, string payload)+event Action<long,int,string> OnResult. The framework never interpretscodeand never touchesdata— it just relays. - Removed
BridgeError/onError: errors are codes. Business owns1/0/10086/…; the framework only mintsRelayCode.Timeout/RelayCode.Disposedwhen it can't get a native result.
Added
NativeChannelFactory.CreateForCurrentPlatform()—#ifplatform dispatch in one place (Editor/Windows → Mock, Android → JNI, iOS → P/Invoke), behindINativeChannel.AndroidChannel(JNI) +IosChannel(P/Invoke + GCHandle) C# sides; native contracts in docs/native-android.md, docs/native-ios.md (build the .aar / native lib on your side).
Verified
- dotnet 38 green; Unity 6: compile clean, EditMode 35/35, PlayMode 3/3 (main-thread dispatch, end-to-end timeout, 1000-request stress, steady-state zero-GC).
Install: https://github.com/forestlii/NativeRelay.git#v0.2.0 · Unity 6+ · MIT · © 2026 Likeon
v0.1.0 — first public release
Thread-safe, zero-GC relay for native async callbacks in Unity — dispatched on the main thread, one request ↔ one result.
Highlights
- Core relay: seed (Interlocked) + pending table + double-buffer queue (lock holds only an O(1) swap) + per-frame main-thread dispatch + timeout cleanup.
- Pure-C# core (
RelayPump) with no UnityEngine dependency; a thinMainThreadDispatcherMonoBehaviour shell. - Robustness: end-to-end request timeout,
Bridge.Disposefails pending withDisposed(no leak), idempotent. - Runs the moment you clone it: pure-C#
MockChannel(no device/key/network). Samples: Basic Mock Demo + ASR Demo (IMGUI, zero extra deps). - Verified on Unity 6: EditMode 36/36, PlayMode 3/3 (incl. 1000-request stress + steady-state zero-GC assertions).
Install
Unity Package Manager → Add package from git URL:
```
https://github.com/forestlii/NativeRelay.git#v0.1.0
```
Requires Unity 6 (6000.4)+. See the README for a 30-second quick start and how to plug in a real native channel.
MIT License · © 2026 Likeon