Unity WebGL在某種程度上支持所有主流桌面瀏覽器。但是,不同瀏覽器之間的支持級別和預(yù)期性能會有所不同。請參閱下表,了解Unity WebGL內(nèi)容支持的瀏覽器功能以及哪些瀏覽器支持它們。
注意:
移動設(shè)備目前不支持Unity WebGL內(nèi)容。它可能仍然有效,尤其是在高端設(shè)備上,但許多現(xiàn)有設(shè)備功能不夠強大,沒有足夠的內(nèi)存來支持Unity WebGL內(nèi)容。出于這個原因,Unity WebGL在嘗試在移動瀏覽器上加載內(nèi)容時會顯示一條警告消息(如果需要,可以禁用它)。
請注意,此兼容性表格對所述瀏覽器的特定版本有效,如上所述。對于未來的版本,應(yīng)該繼續(xù)支持,但在以前的版本中可能不穩(wěn)定。
桌面瀏覽器兼容性表
| 瀏覽器 | Mozilla Firefox 52 | Google Chrome 57 | Apple Safari 11 | MS Edge 16 |
|---|---|---|---|---|
| WebGL Support | Yes | Yes | Yes | Yes |
| Web Audio Web Audio Web Audio API需要在Unity WebGL內(nèi)容中播放聲音。 | Yes | Yes | Yes | Yes |
| 全屏支持 Full-screen support | Yes | Yes | Yes | Yes |
| 光標(biāo)鎖定支持 Cursor locking support | Yes | Yes | Yes | Yes |
| 游戲手柄支持 Gamepad support | Yes | Yes | Yes | Yes |
| IndexedDB 數(shù)據(jù)緩存功能使用的本地存儲對 PlayerPrefs類,和WWW.LoadFromCacheOrDownload是必需的 | Yes Firefox版本42不支持在iFrame中運行的內(nèi)容的IndexedDB。 Firefox 43和更高版本解決了這個問題。 |
Yes | Yes Safari不支持在iFrame中運行的內(nèi)容的IndexedDB。 |
Yes |
| WebSockets Networking 所要求的 | Yes | Yes | Yes | Yes |
| WebRTC WebCamTexture類所要求的。 | Yes | Yes | No | Yes |
| WebGL 2.0 WebGL 2.0 | Yes Firefox 51 and newer | YesChrome 56 and newer | No | No |
| asm.js AOT compilation asm.js是瀏覽器可以針對其進行特別優(yōu)化的JavaScript代碼。實現(xiàn)asm.js支持的瀏覽器可以更快地運行Unity WebGL內(nèi)容,因為Unity使用asm.js. | Yes | No | No | Yes |
| WebAssembly WebAssembly或wasm是一種適用于編譯到Web的新的便攜式,大小高效且加載時間高效的格式。 | Yes Firefox 52 and newer. | Yes Chrome 57 and newer. | Yes Safari 11 or newer | Yes Edge 16 or newer |
| Large-Allocation Http header 幫助瀏覽器確保有足夠的內(nèi)存可用于加載您的內(nèi)容,查閱 Large-Allocation Http Header | Yes Firefox 53 and newer. | No | No | No |
| Brotli Compression (Brotli壓縮) 減少構(gòu)建大小 查閱 Brotli Compression | Yes | Yes | No | Yes |
Notes
- Chrome可能需要大量內(nèi)存來解析生成的JavaScript代碼,這會在32位瀏覽器上加載內(nèi)容時導(dǎo)致內(nèi)存不足錯誤或崩潰。有關(guān)內(nèi)存使用的更多信息,請參閱 Memory Considerations (內(nèi)存注意事項)。

Unity WebGL 中文文檔 Unity 2018.1.b
1. WebGL
2. webGL Browser Compatibility
3. Building and running a WebGL project
4. WebGL: Deploying compressed builds
5. Debugging and trouble shooting WebGL builds
6. WebGL Graphics
7. WebGL Networking
8. Using Audio In WebGL
9. WebGL performance considerations
10. WebGL: Interacting with browser scripting
11. Using WebGL Templates
12. Cursor locking and full-screen mode in WebGL
13. Input in WebGL