Kiwikwi
๐ Joined in 2014
๐ผ 9 Karma
โ๏ธ 8 posts
Load more
(Replying to PARENT post)
(Replying to PARENT post)
(Replying to PARENT post)
This only goes so far. E.g. Unity doesn't have a separate 2D renderer, so your 2D game will use the 3D renderer. (But obviously, a 2D game won't include any 3D materials etc.)
(Replying to PARENT post)
The startup overhead is mostly downloading and parsing of the JavaScript. (WebAssembly basically reduces both by being more compact and easier to parse, but it requires browser support.)
Be sure to read the WebGL section of the manual thoroughly, as it contains several tips on reducing this overhead. Also, the overhead varies a lot depending on the browser, so be sure to test all the major ones (Edge, Chrome, Firefox, Safari).
A classic pitfall is to have collider on some of your game objects, even though the game isn't physics driven. This forces Unity to include the entire physics system in the build.
Even if some systems, like physics, can be removed if not used, Unity is still a full-blown 3D game engine. It can of course also do 2D, but it'll almost inevitably have a higher overhead than a dedicated 2D WebGL engine.
You can also consider showing your own loading screen before/on top of the Unity WebGL player, which can camouflage the load time.
(Replying to PARENT post)
Per the manual: "Mobile devices are not supported by Unity WebGL." (https://docs.unity3d.com/Manual/webgl-gettingstarted.html)
You're not just rendering a picture, you're running a full-fledged high-end game engine, in JavaScript (meaning a ~50% slowdown), and using that to render a picture. It is to be expected that even high-end phones will struggle with that.
Unity WebGL is intended to be used as a frictionless way of distributing games to desktop users (think sites like Kongregate). On mobile, the respective app stores arguably already provides a similarly frictionless distribution option... so just build your project as an app.
Alternatively, you can look into lightweight engines that specifically target WebGL. These will usually run just fine on mobile, though they obviously don't offer the same feature set as Unity.
(Replying to PARENT post)
For the same reason, OS X and Android Linux both have systems for OS managed caches, and AFAIK Firefox already uses these: https://bugzilla.mozilla.org/show_bug.cgi?id=748598
The status on mainline Linux is a bit more nebulous (seems Android's ashmem has been upstreamed, but it's not directly usable on GNU/Linux systems?), and other efforts have stranded: https://lwn.net/Articles/602650/
For some more thoughts about memory management on OS level vs. application level, I can recommend this "random outburst" from the designer of the Varnish HTTP cache: https://www.varnish-cache.org/docs/trunk/phk/notes.html