Do WebGL games work on mobile phones?

I seem to have seen that it was possible, yet I have tried everything and nothing works.

2021.3.2f1

1 Like

Do you have the URL to your game? So it works on a PC/Mac, but not a mobile browser?

No. By Unity’s own admission it does not work.

1 Like

“It might work” per the docs

It works on SOME. But nothing is guaranteed, and basically WebGL+Mobile situation is “Abandone all hope ye who enter here”

Thinking about it, it might be a good idea to try earlier unity version with mobile webgl, like 2020.

2 Likes

With Powershell : python -m http.serveur
j’ai :

Serving HTTP on :: port 8000 (http://[::]:8000/) ...
"GET / HTTP/1.1" 304 -
code 404, message File not found
"GET /Build/test8.data.gz HTTP/1.1" 404 -

On explorer (http://localhost:8000/) :

Unable to parse Build/test8.framework.js.gz! This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: gzip" present. Check browser Console and Devtools Network tab to debug.

Murgilod I am on 2021.3.2f1 .

My phone for the test: iphone 12 pro max.

On itch.io, my project only partially worked once, then it stopped working.

I just recreated a new project, I cleaned up as much as possible, I removed the mobile controls, to see if that wasn’t what was causing the conflict, but still no display. If I understand the error message correctly, I must have made a bad setting.

1 Like

So you would want to get it working locally first, then deploy. Just do Build and Run from the Unity Editor, that will start a local webserver and open your project in a browser. Does that work?

yes, Build and Run works.

I made a translation error with a youtube video, I thought it was a solution to set up mobile webGL.

Which explains why I went on a local test, but it’s just my lack of knowledge.

Great! Next step is to publish to a remote web server, and get it working from a browser on your PC

My English isn’t perfect, but I guess that’s irony ^^

I’ve been sleeping very little lately ^^

If I understood correctly, opening a WebGL project is possible with a mobile.

I am aware of the aesthetic problems that this can cause.

To avoid wasting too much time, do you know of any documentation that explains how to set up this type of project ?

I believe you might need a proper http server. Or something more advanced than python http.server module. Because if you use python’s http.server webgl project webpages can fail to load.

If it doesn’t work on your PC from your web server, it won’t work on mobile either. It’s just a bit easier to test from your PC browser instead of a mobile browser.

néginfini For the python http.server module, I solved the problem by checking “Fallback decompression”.

What are you thinking about?

JeffDUnity3D
If I understood correctly, to continue the tests, you ask me to either :

  • Turn one of my pc into a web server.
  • Either host and configure my WebGL build on a remote server.

That’s right ? I apologize if I ask you the question, but my English is not perfect :confused:

I got this error code on the project hosted on itch, with my phone :

Error code obtained on itch with mobile

RuntimeError: Out of bounds memory access (evaluating '(_main=Module["_main"]=Module["asm"]["Kg"]).apply(null,arguments)')
<?>.wasm-function[427]@[wasm code]
<?>.wasm-function[1551]@[wasm code]
<?>.wasm-function[9786]@[wasm code]
<?>.wasm-function[16514]@[wasm code]
<?>.wasm-function[16530]@[wasm code]
<?>.wasm-function[16466]@[wasm code]
<?>.wasm-function[35275]@[wasm code]
<?>.wasm-function[16566]@[wasm code]
<?>.wasm-function[6346]@[wasm code]
<?>.wasm-function[6345]@[wasm code]
<?>.wasm-function[30635]@[wasm code]
<?>.wasm-function[14258]@[wasm code]
<?>.wasm-function[14257]@[wasm code]
<?>.wasm-function[26663]@[wasm code]
wasm-stub@[native code]
@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:296996
callMain@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:362051
doRun@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:362606
run@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:362775
runCaller@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:361700
removeRunDependency@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:15982
@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:1967
doCallback@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:90173
done@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:90329
@blob:https://v6p9d9t4.ssl.hwcdn.net/7a1801de-2ecc-43f9-9a07-c01872449df6:3:83432

@venom789 What is the URL? Does it work when using your PC browser? If it doesn’t work on your PC browser, it won’t work on your mobile browser either.

If you want Webgl to work on mobile use a different engine.

Every time I tried Unity it worked like ass, or “it might work” as per the docs.

Sorry, yes it works on my pc browser

See the link :

AcidArrow
Indeed I never had this kind of problem on construct, on the other hand in my research, I could note that Ureal had similar problems.

It is normal that large engines have more problems given their complexity.

But if it’s too complicated to solve, I don’t see the point of making you waste too much time on it.

I had in mind a small project on the web, but this is not absolute, and I could very well find alternative solutions :slight_smile:

I guess we need Unity to become a small engine again then.

Yes, the issue is with decompression.

Last time I wrote a webgl unity application was one year ago, and I forgot what I was using. It was not python http server, however because of decompression issues. I think initially I used some small standalone windows application for the server, and then switching to uploading the files to a remote server.

Thank you néginfini,
as AcidArrow says, there are other effective solutions for WebGL (construct, playcanvas …), I have already lost a whole day looking for it, it’s exactly the time I would have spent on another engine to create a prototype and put it online.
I’m a graphic designer, so at the programming level it doesn’t bother me too much, but configuring the software of your server so that it adapts to your project… I have neither the knowledge nor the desire to do it.

Personally I would like to have an answer like this :
for our site play.unity.com, you needed to create your project on

  • such version of Unity,
  • with these settings,
  • this pipeline,
  • …

But I think it goes against the internal policy to do the promotion of obsolete version, for an abandoned platform.

Personally, between the fact that smartphones finally have the necessary capacity to use WebGL effectively, and the major security flaws in the software installed on the phones, I think it’s the right time to develop this technology.

If that’s not unity’s opinion, I respect it, accept what you can’t change.

What I have trouble understanding is why this is hard to implement, if not impossible, on their own play.unity.com site, although they used their own WebGl Publisher export software, on their own server, at the limit we add a small “mobile version” box to check and the export software checks the project, which informs the user of mobile-oriented optimization defaults.

So yes it’s frustrating, but it doesn’t matter, I don’t use Unity specifically for the WEB, like everything this engine has defaults and qualities.

I’m not going to waste any more time on it, and even if the learning curve for each engine is high, I’m not going to limit myself to using just 1. Even if it would be simpler, but i also understand that in this world nothing is simple :wink: