Skip to content

A lightweight development server for Unity WebGL builds with automatic build detection and responsive UI.

Notifications You must be signed in to change notification settings

TheWhiteShadow4/unity-web-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity WebGL Development Server

A lightweight development server for Unity WebGL builds with automatic build detection and responsive UI.

🚀 Quick Start (Windows)

  1. Download the latest release
  2. Place unity-web-server.exe next to your Unity WebGL build folder:
    YourGame/
    ├── Build/           <- Your Unity WebGL build
    │   ├── index.html
    │   └── ...
    └── unity-web-server.exe <- The server executable
    
  3. Start unity-web-server.exe - it will:
    • Automatically try to detect your Unity build
    • Open your default browser
    • Show your game with a responsive UI

That's it! Your game is now running locally.

🎮 User Features

  • Auto-Detection: Finds your Unity build automatically
  • Responsive UI: Dark mode interface with size controls
  • Fullscreen Support: One-click fullscreen mode
  • Size Controls: Auto-detect or manual size adjustment
  • Quick Access: "Open in new tab" option
  • Smart Port Selection: Automatically finds next available port if default is in use

👩‍💻 Developer Information

Command Line Options

unity-web-server [OPTIONS]

Options:
    -p, --port <PORT>      Server port [default: 8080, auto-increments if busy]
    -H, --host <HOST>      Host address [default: 127.0.0.1]
    -n, --headless        Start without opening browser
    -h, --help            Show help

Port Selection

The server will:

  1. Try to use the specified port (default: 8080)
  2. If the port is busy, automatically try the next port (8081, 8082, etc.)
  3. Continue up to 10 ports higher than the specified port
  4. Display a clear message if using a different port than requested

Alternative Placement

You can also place the server inside your build folder:

Build/
├── index.html
├── unity-web-server.exe
└── ...

Build Search Paths

The server looks for Unity builds in:

  1. ../Build
  2. . (current directory)
  3. ../build
  4. ./Build
  5. ./build

Technical Features

  • 🔍 Automatic build & canvas size detection
  • 📦 Brotli (.br) and Gzip (.gz) compression support
  • 🔒 Proper MIME types and CORS settings
  • 🌐 Health check endpoint (/health)

Development

# Debug build and run
cargo run

# Release build
cargo build --release

# Run tests
cargo test

MIME Types Support

Handles all Unity WebGL-specific file types:

  • .wasmapplication/wasm
  • .jsapplication/javascript
  • .dataapplication/octet-stream
  • .symbols.jsonapplication/json

Compression

Automatic detection and correct serving of:

  • Brotli compressed files (.br)
  • Gzip compressed files (.gz)

License

GNU General Public License v3.0

About

A lightweight development server for Unity WebGL builds with automatic build detection and responsive UI.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages