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.
https://react-unity-webgl.dev
Apache License 2.0
1.7k stars 160 forks source link

React router #463

Closed lolik20 closed 1 year ago

lolik20 commented 1 year ago

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?

vokhuyetOz commented 1 year ago

you should put your Build in public folder.