Effortlessly Host Your Unity WebGL Builds Locally


Hey guys! If you're new to Unity WebGL, hosting your build locally can seem quite confusing. Yes, you've built your project in Unity, but now you want to run it locally without constantly rebuilding, right? Especially considering Unity only lets you run a build once. Below is an easy guide to hosting Unity WebGL builds locally on your machine:
Step 1: Install Python First thing's first, check Python is installed on your system. If not, download it from the official Python website and follow the instructions for your operating system to install it.
Step 2: Prepare Your Unity Build Be sure your Unity build is in a state where you would like to host it.
Step 3: Open Terminal / Command Prompt Open Terminal (on macOS or Linux) or Command Prompt (on Windows).
Step 4: Navigate to Your Build Folder Use the cd command to move to the directory containing your Unity build. For example:
~/path/to/YourUnityBuildFolder
Step 5: Run a Simple HTTP Server In the Terminal, or Command Prompt, run the following command to start a simple HTTP server:
python3 -m http.server
On Windows you may need to run this instead: python -m http.server
Step 6: Access Your Unity Build Once the server is up and running, open your web browser and navigate to: http://localhost:8000 If you wish to do this from another device on your local network replace localhost with the local IP of your computer.
Done! You've completed it: hosting your Unity WebGL build locally with Python. Enjoy fast and easy testing and sharing of your Unity project.
Subscribe to my newsletter
Read articles from Tenith directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
