Brotli로 압축 후 빌드하면
https://stackoverflow.com/questions/75872920/how-to-fix-unable-to-parse-build-error-in-webgl-build
How to fix 'Unable to parse Build" error in WebGL build?
I want to host my Unity WebGL in was s3 bucket. When I upload my files to an s3 bucket and open index.html to view the project, I get this error.
stackoverflow.com
Unable to parse build~~
이런 에러가 뜨는데

설정에서 enable decompression fallback을 키는걸로도 해결이 되긴 하지만
저거 키면 엄청 느려진다
안 키고 해결하려면 공식문서를 참고해서
https://docs.unity3d.com/6000.1/Documentation/Manual/webgl-server-configuration-code-samples.html
Unity - Manual: Server configuration code samples
Server configuration code samples Use these code samples to configure your server when working with Web. The following samples apply to Nginx, Apache, and IIS servers. For further information on server configuration for the Web platform, refer to Compresse
docs.unity3d.com
이거 참고해서 수정하면된다
ISS 기준
Web.Config를 수정하면 된다
근데 나는 공식문서랑 똑같이 해도 파싱이 안됐음,,,
<remove fileExtension=".js.br" />
<mimeMap fileExtension=".js.br" mimeType="application/wasm" />
나머지는 같지만 이 부분이 문서에는 javascript로 하라고 되어있는데
wasm으로 바꿔줘야 제대로 작동한다
그리고 멀티스레딩 체크하고 서버에 올리면
https://www.reddit.com/r/unity/comments/163ltqe/unity_webgl_problem_your_browser_does_not_support/
From the unity community on Reddit
Explore this post and more from the unity community
www.reddit.com
이런 에러가 떴다
해결하려면
https://discussions.unity.com/t/your-browser-does-not-support-webassembly-threads/751884/4
https://discussions.unity.com/t/your-browser-does-not-support-webassembly-threads/751884/5
헤더 설정을 해줘야함
https://web.dev/articles/coop-coep?hl=ko
COOP 및 COEP를 사용하여 웹사이트를 '교차 출처 분리'했습니다. | Articles | web.dev
일부 웹 API는 스펙터와 같은 부채널 공격의 위험을 높입니다. 이러한 위험을 줄이기 위해 브라우저는 교차 출처 분리라는 선택 기반의 격리된 환경을 제공합니다. COOP 및 COEP를 사용하여 이러한
web.dev
여기 문서 보면 나와있다
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
<?xml version="1.0" encoding="UTF-8"?>
<!--
The following server configuration can be used for compressed Web builds without decompression fallback.
This configuration file should be uploaded to the server as "<Application Folder>/Build/web.config".
NOTE: To host compressed Web builds without decompression fallback, you need to install the "URL Rewrite" IIS module on the server.
Otherwise, IIS will throw an exception when using this configuration file.
This module is available at https://www.iis.net/downloads/microsoft/url-rewrite.
-->
<configuration>
<system.webServer>
<!--
Compressed Unity builds without decompression fallback can't be properly hosted on a server which
has static compression enabled because this might result in the build files being compressed twice.
The following line disables static server compression.
-->
<urlCompression doStaticCompression="false" />
<!-- To host compressed Unity builds, the correct mimeType should be set for the compressed build files. -->
<staticContent>
<!--
NOTE: IIS will throw an exception if a mimeType is specified multiple times for the same extension.
To avoid possible conflicts with configurations that are already on the server, you should remove the mimeType for the corresponding extension using the <remove> element,
before adding mimeType using the <mimeMap> element.
-->
<!-- The following lines are required for builds compressed with Brotli, which don't include decompression fallback. -->
<remove fileExtension=".data.br" />
<mimeMap fileExtension=".data.br" mimeType="application/octet-stream" />
<remove fileExtension=".wasm.br" />
<mimeMap fileExtension=".wasm.br" mimeType="application/wasm" />
<remove fileExtension=".js.br" />
<mimeMap fileExtension=".js.br" mimeType="application/wasm" />
<remove fileExtension=".symbols.json.br" />
<mimeMap fileExtension=".symbols.json.br" mimeType="application/octet-stream" />
<mimeMap fileExtension=".html" mimeType="text/html" />
</staticContent>
<!--
Hosting compressed Unity builds without decompression fallback relies on native browser decompression,
therefore a proper "Content-Encoding" response header should be added for the compressed build files.
NOTE: IIS will throw an exception if the following section is used without the "URL Rewrite" module installed.
Download the "URL Rewrite" module from https://www.iis.net/downloads/microsoft/url-rewrite
-->
<rewrite>
<outboundRules>
<!--
NOTE: IIS will throw an exception if the same rule name is used multiple times.
To avoid possible conflicts with configurations that are already on the server, you should remove the mimeType for the corresponding extension using the <remove> element,
before adding mimeType using the <mimeMap> element.
-->
<!-- The following section is required for builds compressed with Brotli, which don't include decompression fallback. -->
<remove name="Append brotli Content-Encoding header" />
<rule name="Append brotli Content-Encoding header">
<match serverVariable="RESPONSE_Content-Encoding" pattern=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="\.br$" />
</conditions>
<action type="Rewrite" value="br" />
</rule>
</outboundRules>
</rewrite>
<httpProtocol>
<customHeaders>
<!-- Cross-Origin-Opener-Policy: Same-Origin -->
<add name="Cross-Origin-Opener-Policy" value="same-origin" />
<!-- Cross-Origin-Embedder-Policy: Require-Corp -->
<add name="Cross-Origin-Embedder-Policy" value="require-corp" />
<!-- Cross-Origin Resource Policy: Same-Origin -->
<add name="Cross-Origin-Resource-Policy" value="cross-origin" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
이렇게 수정하면 더 이상 멀티 스레딩 관련 경고 안 뜬다
'Unity' 카테고리의 다른 글
| Unity Flutter Widget No such module unityframework 오류 해결 (0) | 2024.12.20 |
|---|---|
| [Unity] RemoteProviderException: TextDataProvider : unable to load “StreamingAssets /aa/settings.json” 에러 해결 (1) | 2024.11.28 |
| [Unity] Sentis Hand Detection (핸드 트래킹) (0) | 2024.10.24 |
| [Unity] Sentis Human Pose Estimation (포즈 트래킹) (0) | 2024.10.15 |
| [Unity] Android GameActivity Entry point (0) | 2024.09.23 |