question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceError: UnityLoader is not defined

See original GitHub issue

Hi, I know there has been multiple issues relating to this issue and the public path. I have tried the suggested solutions but to no avail.

Errors I receive UnityLoader.js:1 Uncaught SyntaxError: Unexpected token < Unity.js:64 Uncaught (in promise) ReferenceError: UnityLoader is not defined

The unity component is loaded into another component as such

 <Unity
          src="Build/carviewer.json"
          loader="Build/UnityLoader.js"
        />

I have the Build folder in my main app root where my index.html is. I have also tried public/Build.

Not sure if it’s relevant but my webpack config has publicPath: '/',

The unityloader.js is coming up in my sources in chrome dev tools but when I inspect it, it just shows the index.html.

Any help would be greatly appreciated. Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
szewa-polyucommented, Sep 3, 2019

Using the Public Folder in Create React App: https://create-react-app.dev/docs/using-the-public-folder

1reaction
Enough7commented, Apr 23, 2021

For people like me: put your unity build in your public directory and create your UnityContent like this:

let unityContent: UnityContent = new UnityContent(
        '/UnityBuild/Build/Build.json',
        '/UnityBuild/Build/UnityLoader.js'
);

Omit the ./public in the path. This took me forever

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebGL build not working correctly. "UnityLoader is not defined".
1. after build is finished when i open console - i see the error- "UnityLoader is not defined". this is important from my...
Read more >
UnityLoader.js not defined discussion on Kongregate
js is called in the index.html file. But the same error message of "ReferenceError: UnityLoader is not defined" keeps showing in the console...
Read more >
Getting error when launching WebGL unity game
Solved the problem by moving to a non-alpha version of Unity. ... Let's start with reading the error msg: Uncaught **ReferenceError** .
Read more >
Web gl build grey screen - Unity - ZapWorks Forum
1.01:87:1 Uncaught (in promise) ReferenceError: UnityLoader is not defined WaitForZCVLoad https://d9003.zappar.io/1851770358319192628/1.01/: ...
Read more >
Feed Detail - BigCommerce Support
Uncaught ReferenceError: UnityLoader is not defined at (index):9 (anonymous) ... https://blackfriarsironworks.com/confabulator/content/Build/UnityLoader.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found