vfx logo

Github ArtStation ShaderToy HMI LinkedIn

# Docker web server configuration for Unity Web Players: A simple guide for utilizing Docker and Nginx in order locally host and develop Unity Web Players: https://github.com/eldnach/docker-nginx-unity

WebPlayer https://github.com/eldnach/docker-nginx-unity

WebPlayer

## Instructions 1. Before starting, please verify that Docker is installed and running (https://docs.docker.com/get-docker/). 2. Create and navigate to a new project folder. Copy the contents of this repostiory to the root of your newly created project folder. 3. Rename the docker file (`project/docker/project-name.Dockerfile`) and edit the docker-compose file to match the new project's name (`project/docker-compose.yml`)

DockerCompose

4. To reduce application loading times, ensure that Brotli/Gzip compression is enabled in your Unity project's Player Settings (`ProjectSettings -> Player -> Publishing Settings -> Compression Format`), and that "Decompression Fallback" is disabled:

PlayerSettings

5. This repository includes a sample Unity Player at the webplayer directory (`project-folder/webplayer`). To overrwrite the project, build a Unity Web Player and copy the build folder's contents to this directory. 6. Once the web player folder is ready, open a terminal at the project's root, and build a docker image using the following command: "docker build -t :local -f docker/.Dockerfile ." 7. Print and copy the docker image ID using the "docker images" command:

Docker Images

8. Run the docker container using the newly built docker image: "docker run -p 127.0.0.1:hport:cport imageid". Note: You can set both hport (host-port) and cport (container-port) to 80. 9. Once the docker container is running, open a web browser and navigate to "127.0.0.1:hport" in order to launch the web player:

WebPlayer

Note: You can open the developer tools in order to verify that Unity pre-compressed files have been served with the correct `Content-Encoding` header (gzip/br):

WebPlayer

About Me

Realtime graphics enthusiant, currently working as a Technical Product Manager for the Unity Engine.

In this blog, I share some useful tools and personal projects to assist with Unity and realtime graphics development.

v