Web deployment
Matter supports browser builds through Unity's Web platform. The included Feature Showcase build pipeline selects WebGPU first and retains WebGL2 as a compatibility fallback.
Configure graphics APIs
Choose Tools > Matter > Development > Web > Configure WebGPU First. The command sets the Web player graphics API order to WebGPU followed by OpenGLES3/WebGL2.
WebGPU does not support synchronous GPU-to-CPU readback. Use these asynchronous APIs in browser-safe gameplay and persistence code:
SetBackendAsyncReadAllCellsAsyncReadChunkAsyncExtractCellAsyncInjectCellAsyncMatterWorldPersistence.CaptureAsyncMatterWorldPersistence.SaveToBytesAsync
Configure texture compression
Matter prepares its imported sample texture tiers for the active build target before a player build. The platform profiles are:
| Target | Packed color, surface, and normal arrays | Height |
|---|---|---|
| Windows/macOS/Linux | BC7 | R8 |
| Web Generic or DXT | DXT5 | R8 |
| Web ASTC | ASTC 6x6 | R8 |
| Web ETC2 | ETC2 RGBA8 | R8 |
| Android | ETC2 RGBA8 | R8 |
| iOS/tvOS | ASTC 6x6 | R8 |
Generic Web deliberately defaults to DXT5 for desktop browsers. Select the ASTC or ETC2 Web texture subtarget before building for compatible mobile browsers. Runtime tier validation rejects unsupported formats instead of allowing BC7 to expand silently to RGBA32.
Matter distributes no generated texture arrays. Importing or building a Matter
sample generates the target-specific project cache under
Assets/Samples/Matter/Shared/Resources; merely installing the package does
not generate or add the demo arrays to unrelated player builds. The dedicated
WebGPU build pipeline explicitly prepares the Web cache before it starts the
player build.
Serve over HTTP or HTTPS
Do not open the generated index.html directly from disk. Serve the build from
localhost during development and HTTPS in production.
Brotli-compressed output requires the correct content type and
Content-Encoding: br for native decompression:
| File | Content type |
|---|---|
.data.br or .data.unityweb |
application/octet-stream |
.framework.js.br or .framework.js.unityweb |
application/javascript |
.wasm.br or .wasm.unityweb |
application/wasm |
The generated .htaccess files contain Apache rules for Brotli metadata and
cache behavior. Some FTP and archive tools omit hidden files; verify that the
root .htaccess and Build/.htaccess are present after deployment.
If a response contains Content-Language: br instead of
Content-Encoding: br, the server is treating .br as the Breton language
suffix. Correct the server rules, then clear the affected CDN and browser
caches.
Persistence in browsers
Use the byte-based world APIs and store the resulting bytes in the project's chosen browser, download, cloud-save, or service layer. The Feature Showcase flushes its virtual persistent filesystem to IndexedDB before reporting that a save completed.
Networking
The core Feature Showcase is a visual browser demo. Browser networking requires a compatible WebSocket transport and server supplied by the consuming project. See the separately distributed Matter: FishNet Integration guide when using FishNet and Bayou.
Scope of this guide
These headers and compression rules apply to a Unity Web player. The static Matter documentation website is ordinary HTML/CSS/JavaScript and does not need the player's Brotli or cross-origin-isolation configuration.