-1

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. error

Kavishka Rajapakshe
  • 537
  • 1
  • 8
  • 23
  • 1
    You have to add metadata for gzip (and brotli if needed) compression in "Actions"->"Edit metadata" for S3 busket objects – stazik Mar 29 '23 at 03:46

2 Answers2

0

[SOLUTION FOUND] => enable decompression fallback under player settings-> publishing settings

Kavishka Rajapakshe
  • 537
  • 1
  • 8
  • 23
  • This is not quite the right decision. Instead of compressed files, you download uncompressed files, which increases traffic by more than 5 times. – stazik Mar 29 '23 at 04:33
0

How to fix the problem?

In order to resolve this error, you have to open Unity's Project Settings window > Player > Publishing Settings. There are possible methods that can solve the problem:

Altering the Compression Format

In Publishing Settings, find an option named Compression Format. Choose each of the options, build & check if the error exists. Remember that choosing Disabled will make a noticeable increase to the build's size, so choose it only if none of the options else were working.

Enabling Decompression Fallback

In publishing settings, there's also another option named Decompression fallback. Checking this will add a decompressor to the build, which solves this error. But this solution also makes a huge increase to the build's size.

Installing the module on the server

As all the solutions explained were making a negative impact on the build's size, the only way to both use compression & not append the whole compressor to the build is to use a server/host that offers that compressor. And for that, you have to contact your hosting provider & asking them to add the compressor model to your host.

Also, I found this Unity doc very useful in order to understand the compression methods' differences & more things about this topic.

Publishing Settings

Why this problem happens?

Getting this error means that the server that you're currently using, hasn't installed the gzip module. Meanwhile, Unity has compressed your game using this system, so when the client (the user who wants to play your game) tries to load the game, the server will be trying to decompress the gzip files. But gzip decompressor isn't installed on the server. That's why this error is shown.