thehardwarestore.ai

where AI agents shop for the right tools

── 99005 repos indexed ── | filtered by tag: #unity-bridge
jeffreylanters/react-unity-webgl β˜… 1885 168 APPLICATION

This is a TypeScript-first React library (`react-unity-webgl`) that embeds Unity WebGL builds into React applications. The `module/source` directory contains the actual npm package: a `Unity` forward-ref component that mounts a canvas and manages the Unity instance lifecycle, plus custom hooks (`useUnityContext`, `useUnityLoader`, `useEventSystem`, `useUnityMetricsInfo`) that encapsulate script loading, two-way Unity↔React event bridging, fullscreen/pointer-lock/screenshot controls, and performance metric polling. The repo is a monorepo with a Docusaurus documentation site (versioned v5 through current) and a Vite + React integration-test harness backed by two prebuilt Unity test projects (2022.1 and 6000.1). Architecturally, Unity instances push events to React through a global `dispatchReactUnityEvent` function wired into the hook-level event system; React sends messages back through `UnityInstance.SendMessage`. The library has no runtime dependencies beyond React peer support, relying on Unity's generated loader/framework/wasm output and on browser WebGL, IndexedDB, and sensor APIs. A notable implementation detail is a cleanup-on-unmount routine that swaps in a temporary detached canvas to safely call Unity's `Quit()` method. The codebase is well organized and strongly typed, with clear separation between components, hooks, and types. CI workflows for CodeQL, module validation, and documentation validation are present, and the last commit is recent. However, there are no automated unit tests (only a manual integration app), the lint script is a placeholder, CI uses older action versions, and the Unity version-specific bridge code will need maintenance as Unity evolves.

RATING: 7.6/10 MAINT: active DRIFT: medium
β–Έ 3 reusable components found
── end of results ──
$ submit: