Took me a while to find this thread: SOLVED: IIS - configuring it to serve out the new WebGL stack files - how? - Unity Engine - Unity Discussions. The original poster, TwoBob, has figured out how to upload a WebGL build to IIS. The solution needs just slight tweaking: renaming Data to Release and is now compatible with 5.2 and later. If you’re hosting a website (i.e. “WebApp”) on Microsoft Azure, simply upload this file named web.config to your /site/wwwroot/:
I don’t think we can maintain configuration files for all the different Web Servers there are. Instead, in Unity 5.3, we will fall back to decompressing files in JavaScript if the server is not set up correctly, so you will only experience a very minor delay for not having transfers compressed on the http protocol level.
That seems like a really good idea. You could also potentially compress even better, using format-specific compression for each asset if you’re writing your own client-side decompression algorithms. Looking forward to 5.3!
This very nearly worked for me. I’m using Unity 5.4b14 and had to modify the rules to remove the “Compressed” string and also had to create an exception to the Rewrite JS rule for UnityLoader.js.
Well i have tried this solution and it works on Chrome. @sathya You need to create a folder named “Compressed” and put the compressed data files from you’re Release folder in there. But for it only works in Chrome. Not in Firefox.
So i’m realy curious how @Chronovore did it.
I did renamed “Compressed” to “Release” and altered the Regex : “(.)Release(.).js” to
“(?!(.)Release(.)UnityLoader.js)(.)Release(.).js”. That should compress every js file except the UnityLoader.js. But that did not work for me.
@ I hope you can help us out here. Because it is difficult to setup. And i think there are a lot of people using Azure because it is free for startups.
You do not have to configure your server in any special way if you are using Unity 5.3 or above. Under default server configuration the Unity loader should fallback to JavaScript decompression and download the original build files from the Release folder directly. First try to make sure that the default configuration works well for you.
Optionally, you can also configure your server to serve the content of the build.jsgz, build.memgz and build.datagz files on the build.js, build.mem and build.data requests respectively, with the Content-Encoding: gzip response header set. This way the decompression will be performed by the browser, so the initial loading delay will be reduced a bit, still this is an option, not a requirement.
You can also provide the link to your content so that it would be possible to check on your server response and figure out what exactly is going wrong.
I am using azure. ( the app has only 1 button and nothing else)
Using the java script decompression it took 25 seconds to decompress, and as an added bonus the app looks like it’s doing nothing while this is happening - ie the page sits there like nothing is happening - which would make most users assume it’s broken/ didn’t work - which is what I thought until I hit F12 and saw it decompressing. I had other people test it and it took over a minute.
“Optionally, you can also configure your server to serve the content of the build.jsgz, build.memgz and build.datagz files on the build.js, build.mem and build.data requests respectively, with the Content-Encoding: gzip response header set.”
The Network profiler displays the download time of 25 sec and not the decompression time. The decompression time is explicitly displayed in the console in the following way: Decompressed Release/WebGLTest2.jsgz in 243ms. You can remove this delay if you configure your web server to host files using gzip compression. This means that if you configure your server to serve the content that can be decompressed by the browser, you will save just about 0.24 sec, which means that the decompression overhead in most cases is insignificant.
Still you may want to configure your server, as this should also make the loading progress bar update correctly, so the user will be able to see that the game is loading.
Upload a fresh release build to your IIS server without making any additional changes in the build files or in the server configuration on the levels which are parent to the build. Then add the following web.config file to the Release subfolder:
Note: when copying the configuration from the snippet above, make sure the web.config file starts immediately with <?xml without any preceding characters or newlines. You can also setup the same configuration using IIS Manager, by adding MIME types, and URL Rewrite inbound and outbound rules for your Release subfolder.
You can safely ignore those warnings, they should not affect the game functionality. They have been already taken care of and will non be displayed in the future releases.
This one is easy. Your build does not load, because you modified the html file (manually adding “gz” to the links). Just use the originally generated build files and it should work well.
Thanks Alex, I had tried that before, but it seems the error in the browser telling me the .mem file could not be found threw me off.
It also turns out I wasn’t patient enough, because the Azure VM I am hosting the files on, were only being downloaded at a paltry 60kb/s which is no wonder the game never seemed to load.
Anyway, it works now, thanks for the help.
PS : Is there any update on when can we expect a decent loading screen/template for WebGL?
The current one is really bad.
The game start for me, but it take time.
I have checked by inspecting the element and the http://23.96.38.122/Release/Builds.datagz size is 133 MB and the download is a bit slow.
Thanks for the feedback, which country are you in? I fired up a East US Azure VM, which probably isn’t the best location if I’m in New Zealand for speed. But I have prospective publishers looking at the game and they mostly in the US.
I’m French and http://23.96.38.122/Release/Builds.datagz run around 2mo/S for me.
133 MB is a bit big from the start, you must reduce it or use assetbundle to reduce the “waitting time”.