I just finished coding a website with a Virtual Tour made on Unity, i've exported it as WEBGL with compression format disabled, and decompression fallback off(Unity). Then added this to my code on React
import React from "react";
import Unity, { UnityContext } from "react-unity-webgl";
const unityContext = new UnityContext({
loaderUrl: "../Build/unity341.loader.js",
dataUrl: "../Build/unity341.data",
frameworkUrl: "../Build/unity.framework.js",
codeUrl: "../Build/unity341.wasm",
});
function Game() {
return <Unity unityContext={unityContext} />;
}
export default Game;
then imported the game on the page
import React, {Component} from 'react';
import Game from './game.jsx';
import {Container} from 'react-bootstrap';
class GamePage extends Component {
render() {
return (
<div>
<Game/>
<Container>
//text and stuff inside the container
</Container>
</div>
);
}
}
export default GamePage;
But when i render it on my localhost i dont get the Unity viewer, and when inspecting on Chrome the only thing i see where the game should be is the following tag
<canvas class>
Thanks for your help guys !
