mostly data stuff
by
Here’s a quick guide to exporting your Unity game as WebAssembly (Wasm) and setting it up to run on your website using Docker Compose. Let’s dive in!
File
> Build Settings
. In the Build Settings window, select WebGL as your platform.Build
to generate your game as a WebAssembly build. Unity will create an HTML file, along with .wasm
and .data
files in the chosen directory.To serve your WebAssembly files, we’ll use Nginx as a simple web server.
FROM nginx:alpine
COPY ./Build /usr/share/nginx/html
EXPOSE 80
docker build -t unity-wasm .
in your terminal to create a Docker image.We’ll orchestrate our setup using Docker Compose.
Create a docker-compose.yml
File:
version: '3'
services:
web:
build: .
ports:
- "8080:80"
Start the Service: Run docker-compose up
in your terminal. It will build and launch the Nginx server.
http://localhost:8080
to see your game up and running!By exporting your Unity game as WebAssembly and using Docker Compose, you’ve set up a web server that can run your game in a consistent, isolated environment. This makes deployment simple and scalable.
Happy gaming, and feel free to share your experiences!