WebGL
How can I host a local server which supports file url's so I'm able to playtest WebGL builds?
A WebGL build is used to play a game in your web browser. To test this, you need some kind of server to host the build. Unity has it's own local server when you choose to build & run option, but this doesn't seem to be working in our project and is not always convenient when you'd want to playtest the same build again. Either way I need to find a way to host a local server for playtesting the WebGL builds. This is necessary, because Harm would like the game to be available in a lot of different ways in case in doesn't go well with the games on the App and Google Play Stores.
Research Methods
Library
- Available product analysis + Community research
I started searching the web for the easiest way people found to host WebGL builds. I quickly stumbled across a Unity Forum post[1]. This had plenty of ways people managed to setup a way to host their builds. I used this page to start trying things out.
Workshop
- Prototyping
The first I thing found was to use Python for a localhost server which supposedly supports file url's. This would be convenient for me as I already have Python 3.9.2 installed on my laptop.

The line above in cmd creates a localhost:8000 server as seen below.

The problem with this however is that the page didn't seem to start as it was stuck on loading so I looked for something more convenient and easy to use.
After some more digging I saw someone who used a Google Chrome extension to host a server for local files. It is called Web Server for Chrome and is used exactly for people in my situation so it's a perfect solution if it works.

The only thing I have to do is browse to the intended WebGL build folder and click the link seen above and everything works as intended as seen in the results
Funnily enough the Python method suddenly worked when I tried it again after finding the Web Server for Chrome method
Results & Validation
The result is that I'm now able to test if WebGL builds work as intended as this is one of the criteria for the company. It is very easy to do and takes less than a minute to set up each time I want to test a new build.

The negative about this is that other interns don't have Chrome and for that, can't use this method. I have shared the Python method with him and because of that he'll be able to easily playtest WebGL builds as well.
The Chrome extension works really well though, so when using Chrome, I would recommend that method for faster and easier implementation with lower chance of complications.
Usage
Every time the game needs to be tested in a WebGL build and as a proof of concept that it is possible to release the game as a web game in the future.
Sources
How to manually start a localhost version of WebGL build. (2019, August 5). Unity Forum. Retrieved February 16, 2022, from https://forum.unity.com/threads/how-to-manually-start-a-localhost-version-of-webgl-build.722399/ [1]