Uncaught SyntaxError: Invalid or unexpected token
entershadowweb4.loader.js:1 Uncaught ReferenceError: unityFramework is not defined
at HTMLScriptElement.n.onload (entershadowweb4.loader.js:1)
entershadowweb4.loader.js:1 [UnityCache] 'http://192.168.56.1:8000/entershadowweb4/Build/entershadowweb4.data.gz' successfully downloaded and stored in the indexedDB cache
Win10. 2020.2.0a7. Same with 2020.1.
I’m testing a build using miniweb of [enter shadow] by iwanPlays but I also created a fresh empty project with 2020.2.0a7 and got the same result. Optimized for speed, not size.
Hey, I’m pretty new to unity and want to put my first game on itch.io.
However, whenever I run the ZIPPED file in the unpublished draft, it says “invalid token ‘<’”
PLEASE HELP!
An error “Uncaught SyntaxError: Invalid or unexpected token” or "“invalid token ‘<’” suggests that the compression setting did not match with the server hosting configuration:
either the server is set to host pre-compressed content (by enabling the Content-Encoding: gzip HTTP response header on the resources), but the files that have been uploaded to the server are not actually pre-compressed; or
the server is not set to host pre-compressed content (no Content-Encoding: gzip HTTP response header is configured), but the files that have been uploaded have been pre-compressed.
That is, the two things need to match: if one uploads uncompressed content, then “Content-Encoding: gzip” HTTP response header must NOT be present in the server configuration, and if one uploads precompressed content, then “Content-Encoding: gzip” HTTP response header MUST be present in the server configuration.
Not familiar with how itch.io configures its hosting, but maybe there is a way to toggle the “Content-Encoding: gzip” in its configuration system?
Thanks for this fallback solution!! This works for me. Had to get this up before the morning and I don’t have access to our servers, so this was a great solution until we can make that change. It loads slowly for now, but at least it loads. And I’m assuming it loads at least a bit more quickly than skipping compression altogether.
I have never before seen that kind of http-equiv line. Do you have a reference about this? (my google turned up nothing) In my current understanding that cannot work because a) meta directives should only apply to the file they are in (in this case index.html), and b) the directive is inside the very content that is to be compressed, so a browser should successfully decompress the content first to get to know what the compression is? (a chicken-and-an-egg problem)
This looks good to me Are you using Apache web server? Are there any errors in the log? Are mod_mime & mod_deflate enabled? Are .htaccess files enabled? Check out e.g. https://discussions.unity.com/t/698111
“Disable Compression” is the real solution if the web hosting one is using already employs on-demand caching server-side compression. When hosting content on such a server, users should disable compression in Unity builds.
I meant if older versions of Unity doesn’t have this problem, How this can be a real solution? It is a new problem on Unity 2020. Is this a bug? Or older versions of Unity have bug?? Sorry, i am just asking these questions to myself for many months.
The only difference between older Unity versions and newer versions is that we have changed the default settings: starting from 2020.1, software compression fallback is disabled by default; whereas in older versions it was enabled by default. That is what makes it look as if Unity 2020.1 has a “bug”. If you enable software decompression fallback, you will get old behavior back.
The core thing here is that nobody should be using software compression fallback. Sure it will have the effect of making the page load, but at great expense to startup times if the server configuration is not correct. That in turn will lead to people blaming Unity that Unity is slow to start up in the browser, when in reality the issue was that the hosting web server did not have the correct configuration.
Hence we want to switch gears and push developers towards the right performant solution out of the box: get the server configuration right.
Unfortunately the way that this change landed in Unity 2020.1, the startup experience missed good diagnostics messages to explain when server compression was misconfigured. We have just recently improved this, so next Unity point release should print out more helpful messages at startup if server compression configuration is not properly set up.
The improved error messages have landed in to Unity 2021.1.0a4 in November 2020, with a backport request active for Unity 2020.2, but that has unfortunately not yet landed. If possible try checking out Unity 2021.1.0b4 Pre-Release where the improved error messages should exist.