jeffreylanters / 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.

Home Page:https://react-unity-webgl.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React router

lolik20 opened this issue · comments

commented

Please avoid duplicates

Language and Compiler

Other JavaScript compiler

What environment are you using?

Local Development Server

When does your problem occur?

I don't know

What does your problem relate to?

The problem seems Module related

React-Unity-WebGL Version

last

React Version

15

Unity Version

last

What happened?

I have react router and i want add webgl game on page

Reproducible test case

import style from "./game.module.css"
import React from "react";
import loaderUrl from "./Build/build.loader.js"
import dataUrl from "./Build/build.data.br"
import frameworkUrl from "./Build/build.framework.js.br"
import codeUrl from "./Build/build.wasm.br"
import { Unity, useUnityContext } from "react-unity-webgl";

export default function Game (){

  const { unityProvider } = useUnityContext({
loaderUrl: loaderUrl,
dataUrl:dataUrl,
frameworkUrl: frameworkUrl,
codeUrl: codeUrl

});

return(
    < div className={style.container}>
         < Unity unityProvider={unityProvider} />
    < /div>
);

}
image
image
image

Would you be interested in contributing a fix?

  • yes, I would like to contribute a fix

you should put your Build in public folder.