+ This post requires you to have a pre-existing website on Azure. If you need one, it takes 2min to setup WordPress on Azure.
+ My project did not use add-ons or plugins. Using either may not be compatible with WebGL.
By default, Azure restricts access to the .mem and .data mimeTypes. In order for our project to run, we’ll need to add them to our web.config file located in our root folder.
Unity Build Settings
+ Select File > Build Settings.
+ Switch platform to WebGL.
+ Edit Optimization Level to Fastest. This means our build will takes some time but will have all optimizations and a smaller build size which is great for the user.
WebGL allows you to select an Optimization level in the Build Player window. These correspond to optimization flags (-O1 – -O3) passed to the emscripten compiler. In general, “Slow” produces unoptimized builds, but has much lower build times then the other options, so it can be used for iterating on code issues. “Fast” produces optimized builds, and “Fastest” enables some additional optimizations, but makes your builds take a long time to complete (so you might want to use it only for final releases).
+ Select Player Settings > WebGL > Publishing Settings.
+ Edit WebGL Memory Size to the amount of memory required to run your project.
The WebGL memory size field in Publishing Settings lets you specifiy how much memory (in MB) the content should allocate for it’s heap. If this value is too low, you will get out of memory errors when your loaded content and scenes would not fit into the available memory. But if you set this value too high, your content might fail to load in some browsers or on some machines, because the browser might not have enough available memory to allocate the requested heap size.
Build Performance tips
+ Don’t build Development builds when publishing as they are unminified to preserve function names.
+ Set Optimization Level to “Fastest”.
+ Set “Enable Exceptions” in Player Settings to “None”.
+ Enable “Stripping Level” in Player Settings, removes unused features.
+ Data caching downloads files to make additional launches faster.
FTP to Azure
From the Azure portal, navigate to your web app dashboard and scroll down to get your FTP settings. If you do not remember you password, you can reset via the Reset your deployment credentials link under quick glance section on the right side.
Open up your FTP program and transfer your Unity WebGL export over to Azure.
+ Place build folder under wwwroot.
+ Delete the file .htaccess from your project folder on Azure.
Ready set play!
Play example http://glitchbeam.com/game/hypernaut.
+ Build a virtual arcade or apply towards your portfolio.
+ Monetization – Add Ads for additional revenue. Place them on the web pages and keep your projects clean.