「Unity/WebGL/ビルド」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→httpのポートがわからない場合) |
(→httpのポートがわからない場合) |
||
行9: | 行9: | ||
ブラウザで、localhost:56648にアクセスする | ブラウザで、localhost:56648にアクセスする | ||
+ | |||
+ | ==wasmの警告が出る場合== | ||
+ | 警告詳細 | ||
+ | Http Response Header "Content-Type" configured incorrectly on the server for file [path].wasm, should be "application/wasm". Startup time performance will suffer. | ||
+ | |||
+ | 以下を.htaccessへ記述 | ||
+ | <pre> | ||
+ | <IfModule mod_mime.c> | ||
+ | AddType application/wasm wasm | ||
+ | AddType application/octet-streamt data | ||
+ | AddType application/javascript js | ||
+ | <FilesMatch "(\.js.gz)$"> | ||
+ | Header set Content-Encoding gzip | ||
+ | Header set Content-Type application/javascript | ||
+ | Header append Vary Accept-Encoding | ||
+ | </FilesMatch> | ||
+ | <FilesMatch "(\.data.gz)$"> | ||
+ | Header set Content-Encoding gzip | ||
+ | Header set Content-Type application/octet-streamt | ||
+ | Header append Vary Accept-Encoding | ||
+ | </FilesMatch> | ||
+ | <FilesMatch "(\.wasm.gz)$"> | ||
+ | Header set Content-Encoding gzip | ||
+ | Header set Content-Type application/wasm | ||
+ | Header append Vary Accept-Encoding | ||
+ | </FilesMatch> | ||
+ | <FilesMatch "(\.js.br)$"> | ||
+ | Header set Content-Encoding br | ||
+ | Header set Content-Type application/javascript | ||
+ | Header append Vary Accept-Encoding | ||
+ | </FilesMatch> | ||
+ | <FilesMatch "(\.data.br)$"> | ||
+ | Header set Content-Encoding br | ||
+ | Header set Content-Type application/octet-streamt | ||
+ | Header append Vary Accept-Encoding | ||
+ | </FilesMatch> | ||
+ | <FilesMatch "(\.wasm.br)$"> | ||
+ | Header set Content-Encoding br | ||
+ | Header set Content-Type application/wasm | ||
+ | Header append Vary Accept-Encoding | ||
+ | </FilesMatch> | ||
+ | </IfModule> | ||
+ | </pre> | ||
+ | |||
+ | 参考:https://picosy.jp/wp/unity-for-webgl-comp-build-exe/ |
2023年1月18日 (水) 11:47時点における最新版
WebGLでビルド方法
- BuildSetting/BuildAndRunでBuildする。
- 完了すると勝手にhttpのページが開く
httpのポートがわからない場合
コンソールで調べることができるかも。
$ lsof -i | grep localhost: | grep LISTEN | grep IPv6 >mono 20353 mac1 5u IPv6 0x39faa72716fe3067 0t0 TCP localhost:56648 (LISTEN)
ブラウザで、localhost:56648にアクセスする
wasmの警告が出る場合
警告詳細
Http Response Header "Content-Type" configured incorrectly on the server for file [path].wasm, should be "application/wasm". Startup time performance will suffer.
以下を.htaccessへ記述
<IfModule mod_mime.c> AddType application/wasm wasm AddType application/octet-streamt data AddType application/javascript js <FilesMatch "(\.js.gz)$"> Header set Content-Encoding gzip Header set Content-Type application/javascript Header append Vary Accept-Encoding </FilesMatch> <FilesMatch "(\.data.gz)$"> Header set Content-Encoding gzip Header set Content-Type application/octet-streamt Header append Vary Accept-Encoding </FilesMatch> <FilesMatch "(\.wasm.gz)$"> Header set Content-Encoding gzip Header set Content-Type application/wasm Header append Vary Accept-Encoding </FilesMatch> <FilesMatch "(\.js.br)$"> Header set Content-Encoding br Header set Content-Type application/javascript Header append Vary Accept-Encoding </FilesMatch> <FilesMatch "(\.data.br)$"> Header set Content-Encoding br Header set Content-Type application/octet-streamt Header append Vary Accept-Encoding </FilesMatch> <FilesMatch "(\.wasm.br)$"> Header set Content-Encoding br Header set Content-Type application/wasm Header append Vary Accept-Encoding </FilesMatch> </IfModule>