Skip to content

Releases: forestlii/NativeRelay

v0.2.0 — pure-code contract + platform dispatch

Choose a tag to compare

@forestlii forestlii released this 28 Jun 22:59

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 interprets code and never touches data — it just relays.
  • Removed BridgeError/onError: errors are codes. Business owns 1/0/10086/…; the framework only mints RelayCode.Timeout/RelayCode.Disposed when it can't get a native result.

Added

  • NativeChannelFactory.CreateForCurrentPlatform()#if platform dispatch in one place (Editor/Windows → Mock, Android → JNI, iOS → P/Invoke), behind INativeChannel.
  • 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

Choose a tag to compare

@forestlii forestlii released this 28 Jun 19:06

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 thin MainThreadDispatcher MonoBehaviour shell.
  • Robustness: end-to-end request timeout, Bridge.Dispose fails pending with Disposed (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