fix: game root link

This commit is contained in:
Akuoko Daniel Jnr 2020-12-17 22:47:04 +00:00
parent d9b8d16f6a
commit 8fe4dfb99c
No known key found for this signature in database
GPG Key ID: 1C95803CACD3E9DC

View File

@ -27,16 +27,13 @@ const _cleanScripts = () => {
};
const UnityFrame = ({ url, unityGameLoader, unityGameConfig }) => {
// NOTE (daniel): url to unity game root
const gameRootUrl = url.split("/index.html")[0];
React.useEffect(() => {
let unityInstance;
_loadScript(`${gameRootUrl}/${unityGameLoader}`).then(() => {
_loadScript(`${url}/${unityGameLoader}`).then(() => {
if (window) {
unityInstance = window.UnityLoader.instantiate(
"unityContainer",
`${gameRootUrl}/${unityGameConfig}`
`${url}/${unityGameConfig}`
);
}
});