Hello,
I’m trying to reduce my webGL build for my project ,
in order to do that i’m trying to avoid using System at all costs (as i’ve got 2.4mb of textures and 5.4mb of dlls !! )
But i’m stuck at the beginning:
I’ve got a declaration of
String[ ] whatevervariable;
and it seems that just using System.Collections; isn’t enough…
what is the best way to avoid using the whole System dll’s? and to control the using of these huge dll’s in a project that contents no physics or whatever (it’s not even a game )
What I’m curious is why use String[ ] instead of string[ ]?
Next, what is your final build size when you build out the project? If you do have a lot of textures, perhaps consider the crunch compression if you are able. Heck, any compression is better than Truecolor if you can help it for webgl.
oh because i’m used to making games in unity, and wanted to use some of the features for a webapp with Gmap functions that can easily been converted to phone app. But I hadn’t though that web build can be this size. (I guess that even for a web Game 7Mb is way too heavy for most of users)
sounds to me like they’re trying to avoid the dll’s being included in his build.
And specifically System.dll
But they’re talking about ‘String’. Which is in the System namespace… you can’t avoid the System namespace. Even if you don’t access it, you’re indirectly accessing it.
Now String exists in the mscorlib.dll, this dll MUST be included, there’s no ifs/ands/buts about it. Mono doesn’t work without mscorlib.dll
System.dll on the other hand contains several extra classes in the System namespace. Non of which are String. But there’s all sorts of stuff in there, one can decompile it to see.
I’ve never tried removing dependencies on System.dll (as opposed to the entirity of the System namespace… which again, you can’t avoid). I have no idea if Unity themselves have dependencies on the System.dll. There’s a lot in there.
…
So here it appears it says Unity does not have dependencies on System.dll specifically.
But like I said… String is not in that, it’s in mscorlib.dll, which MUST be included. You must have a dependency on System.dll elsewhere. Are you using 3rd party stuff? You mention Gmap in your latest post… do you mean the google GMap stuff? Are you using a .net library to integrate with the GMap functionality, it may have dependencies on System.dll as well as System.Core.dll since a lot of web stuff is in there like Uri and what not?
I also still don’t see how Unity is useful for Gmap stuff… you could easily write a webapp in many other much more lightweight frameworks that can be easily ported to mobile as well.
because I wasn’t aware that it made a difference , now thanks to you I know.
My final build size is approx. 7Mb with 1.4Mbs of texture and 5Mbs of dlls.
I haven’t purged all the unecesary texture from now, but they’re compressed, but it’s not the main part of my build as you can see.
When making little games app I Wasn’t really into file size, but now that I’m making for the web I’m amazed by the size
Oh, it’s just because I’m not a programer, I’m doing this on my ‘little’ spare time and I haven’t much time left to learn all the framework libs and so on; So i’m stick to what I use the most, it’s little projects, not commercial ones
Honestly, 7 mb for a webgl app/game isn’t that bad at all. Our live webgl game runs at around 23mb, which is a Facebook game. The nice thing is, only the initial load is slower, after that, it loads as fast as on mobile.
Heck, Unity has improved greatly their webgl build sizes as it use to be much larger.
But if you are worried about it, split out your textures into an asset bundle. Download the minimum in the build to get your game playing, then stream in the rest while players look at the menu or go through the first level.
So yeah, I think it’s something else causing it… maybe unity is doing a bad job at not including System.dll
Since I just made a build of a completely empty game, except for a GameObject containing a single script:
using UnityEngine;
public class BugTest : MonoBehaviour {
public long Value;
}
No ‘string’ or ‘String’ anywhere (noting that String and string are the same thing).
And it is including both System.dll and System.Core.dll in the build.
I’m thinking unity is just adding these themselves, maybe UnityEngine.dll had dependencies added in recent versions, and maybe that documentation I linked earlier is outdated.