How to use react-unity-webgl - 1 common examples

To help you get started, we’ve selected a few react-unity-webgl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jeffreylanters / react-unity-webgl-test / src / App.js View on Github external
constructor(props) {
    super(props);
    this.speed = 30;
    this.state = { rotation: 0, unityShouldBeMounted: true };

    this.unityContent = new UnityContent(
      "unity_project_build/Build.json",
      "unity_project_build/UnityLoader.js"
    );

    this.unityContent.on("Say", message => {
      console.log("Wow Unity said: " + message);
    });

    this.unityContent.on("SendRotation", rotation => {
      this.setState({ rotation: Math.round(rotation) });
    });

    this.unityContent.on("progress", progression => {
      console.log("Unity progress", progression);
    });

react-unity-webgl

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.

Apache-2.0
Latest version published 11 days ago

Package Health Score

86 / 100
Full package analysis

Popular react-unity-webgl functions