I exported my WebGL app (Unity 2021.1.24f1) and it’s already on the Tomcat server but whenever the Unity loading screen is shown, there’s some type of warning above the logo in a yellow box (with a white border):
“Build/2.wasm” exists in the export. Is that something I have to change for the export or on the server? What exactly do I have to change? I found this and this but I’m not sure I understand what the message is asking of me or where to add stuff, tbh.
[quote=“Mashimaro7, post:5, topic: 864159, username:Mashimaro7”]
Thanks for your solution! But, where is the web.xml? I can’t find it in either my project or my build.
[/quote]The web.xml is a file on the server/in your server project that calls your Unity WebGL project.
Hello, I am facing the same issue! I can’t find any web.xml file in my server folder. What have happen to my hosting? I use wordpress on hostinger server. I want to upload my WebGl to my hostinger server
Hello, unfortunately I have no real solution for the problem. But you can remove the error message that is displayed. To do this simply disable line 70 and 72 in the WebGL.loader.js file. This works with a development build.
if (typeof message === 'string' && message.indexOf('wasm streaming compile failed') != -1) {
if (message.toLowerCase().indexOf('mime') != -1) {
// showBanner('HTTP Response Header "Content-Type" configured incorrectly on the server for file ' + Module.codeUrl + ' , should be "application/wasm". Startup time performance will suffer.', 'warning');
} else {
//showBanner('WebAssembly streaming compilation failed! This can happen for example if "Content-Encoding" HTTP header is incorrectly enabled on the server for file ' + Module.codeUrl + ', but the file is not pre-compressed on disk (or vice versa). Check the Network tab in browser Devtools to debug server header configuration.', 'warning');
}
}
For a normal build delete or comment out the first if statement in WebGL.loader.js.
it is marked in bold in the code example below:
function createUnityInstance(e,r,n){function o(e,n){i**f(!o.aborted&&r.showBanner)return"error"==n&&(o.aborted=!0),r.showBanner(e,n);**switch(n){case"error":console.error(e);break;case"warning":console.warn(e);break;default:console.log(e)}}function t(e){var r=e.reason||e.error,n=r?r.toString():e.message||e.reason||“”,o=r&&r.stack?r.stack.toString():“”;if(o.startsWith(n)&&(o=o.substring(n.length)),n+=“\n”+o.trim(),n&&c.stackTraceRegExp&&c.stackTraceRegExp.test(n)){var t=e.filename||r&&(r.fileName||r.sourceURL)||“”,a=e.lineno||r&&…
[quote=“jayray2000, post:11, topic: 864159, username:jayray2000”]
That’s right, but I have no idea where to find the web.xml file or where to put it on my server…
[/quote]It should already be on the server. If you don’t know what you’re doing, then the last thing you should do is messing with Unity’s files and disabling the error won’t fix the underlying problem anyway.
Could you tell us where the ‘web.xml’ file is expected to be found on an Apache server? I am using shared hosting and familiar with updating .htaccess and .httpconf files but not web.xml files. I have been uploading WebGL builds to this particular server for years and never encountered this before doing a WebGL build with Unity 2021. I have contacted my webhost support chat and requested they update the ‘web.xml’ file and they said it does not exist.
EDIT: I added the following to the .htaccess file within the root of my project (where index.html is) and that resolved the issue - did not need to locate the web.xml.
I added the following to an .htaccess file (I created myself) within the root of my project (where index.html is) and that resolved the issue - did not need to locate the web.xml.
For anyone using Apache2, you can either use .htaccess as mentioned in post #14, but some apache installations don’t have .htaccess files enabled, like mine.
I added AddType application/wasm .wasm to /etc/apache2/ mods-enabled/mime.conf