Skip to main content
drawingdrawing

React Unity WebGL

Bringing your Unity Games to the Web since 2017!

license npm build deployment stars downloads size sponsors support discord

When bringing your Unity Application to the web, you might need to communicate with Components on a webpage, build interactive interfaces or might want to implement functionality using Web APIs which Unity does not expose. Combining Unity with React is a great way to achieve these goals. React Unity WebGL provides a modern solution for embedding Unity WebGL builds in your React Application while providing advanced APIs for two way communication and interaction between Unity and React.

% npm install react-unity-webgl
A basic example showing how to embed a Unity WebGL build in your React Application.
import React from "react";
import { Unity, useUnityContext } from "react-unity-webgl";

function App() {
const { unityProvider } = useUnityContext({
loaderUrl: "build/myunityapp.loader.js",
dataUrl: "build/myunityapp.data",
frameworkUrl: "build/myunityapp.framework.js",
codeUrl: "build/myunityapp.wasm",
});

return <Unity unityProvider={unityProvider} />;
}