Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm file downloads twice #531

Open
1 of 2 tasks
MarkZamoyta opened this issue Nov 15, 2023 · 5 comments
Open
1 of 2 tasks

wasm file downloads twice #531

MarkZamoyta opened this issue Nov 15, 2023 · 5 comments
Assignees
Labels

Comments

@MarkZamoyta
Copy link

Please avoid duplicates

Language and Compiler

TypeScript's built-in Compiler

What environment are you using?

Local Development Server

When does your problem occur?

When the Unity Component mounts

What does your problem relate to?

The problem seems Unity related

React-Unity-WebGL Version

9.4.3

React Version

17.0.2

Unity Version

2021.3.16f1

What happened?

My game downloads but gets stuck for 25 seconds at 90%. I looked at what was going on during that time, and the browser is downloading the wasm file twice. On a chromebook with limited resources, it doesn't get cached (ever), so this doubles the download time. On a PC, everything is fine because the wasm file is cached after the first download, and the 2nd download is near instant.
Is there a way to prevent it being downloaded twice? It happens somewhere in useUnityContext() before it sets isLoaded to true.

Reproducible test case

No response

Would you be interested in contributing a fix?

  • yes, I would like to contribute a fix
@jeffreylanters
Copy link
Owner

would it be able for you to share some code? it might be caused by unintentional rerenders

@lzqlawrence
Copy link

i also got the same issue on my PC chrome and mobile chrome. the *.wasm file will download twice.

@MarkZamoyta
Copy link
Author

MarkZamoyta commented Dec 30, 2023 via email

@lzqlawrence
Copy link

i also got the same issue on my PC chrome and mobile chrome. the *.wasm file will download twice.

when i build a release build, it's fine. so the *.wasm file only download twice in development build

@lia12345kimo
Copy link

lia12345kimo commented Dec 10, 2024

I found the reason
web server settgin mine type

looking
https://docs.unity3d.com/2021.2/Documentation/Manual/webgl-server-configuration-code-samples.html

file type ==> .wasm
mimeType ==> application/wasm

You can avoid it twice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants