Repository navigation
Feature/improve bridge - #11
Merged
Merged
Conversation
Core fixes ngx-unity-viewport.component.ts: failed loader scripts are evicted from the cache so the same buildPath can retry; a broken build now emits a loadError output (with a fallbackToMock input and loadFailed signal to opt out of the silent mock fallback); compression probes run in parallel and overlap the loader download (~10 serialized round-trips down to ~2); loader failures no longer escape as unhandled rejections. The ngx-unity peerDependency on @angular/core is now ^22.0.0 (was ^21), and empty string-array events from Unity now yield [] instead of [""]. Generators (JSLibExport.cs, AngularExposedExport.cs): wrapped in try/catch so a locked file can't crash Unity editor init, and they only write output when content actually changed — no more Angular dev-server rebuilds on every Unity domain reload. Shared helpers moved to a new BridgeGeneratorUtilities.cs. The client generator now emits unity-client.ts (kebab-case, matching what was committed) and imports IUnityInstance from a configurable path (default ngx-unity), so regenerating no longer breaks the app. New features Typed JSON payloads: JsonType = typeof(MyDto) on [AngularExposed]/[JSLibExport] generates a matching TS interface (new TypeScriptInterfaceGenerator.cs) plus automatic JSON.stringify/JSON.parse. Demonstrated in the demo via SpawnFromJson(SpawnRequest) and SendSceneState(SceneState). Multi-instance routing: the generated jslib tags every Unity → Angular call with the canvas id from Module.canvas — zero C# API and no handshake race. The generated service gains forInstance(canvasId) returning a per-instance channel of signals/callbacks; flat signals keep their old behavior, and calls from older jslib builds route to a "default" channel (I confirmed this backward-compat path live, since the committed Unity build predates the feature). The viewport gained canvasId/resolvedCanvasId and an instanceCreated output carrying the id. Tests + CI Fixed broken test infra (the library's tsconfig.spec.json didn't exist; the app had no test target at all), then added 40 vitest specs across 5 files covering the viewport (mock fallback, compression detection, loader dedup, error paths, retry-after-failure), the mock utilities, the generated service contract (including forInstance and JSON parsing), and the bridge service. New ci.yml runs build + both suites + app build on pushes and PRs (Node 24). Docs Root README: fixed the wrong "Angular 16+" claim and broken license badge, added the JSON payloads section, rewrote Multi-Instance around forInstance, documented all new APIs, and ticked the JSON TODO. Rewrote the library README (what npm shows), and added CHANGELOG.md (retro-filled from the 21.0.0/22.0.0 tags) and CONTRIBUTING.md.
|
Visit the preview URL for this PR (updated for commit 8af686a): https://ngx-unity--pr11-feature-improve-brid-a83epzxf.web.app (expires Wed, 29 Jul 2026 09:34:25 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6d1b9e0f522683ad84db4253f6fed8bc0b01100d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.