WebGL build output

Hey,

I am reading this link: Unity - Manual: Build your WebGL application
It specifies what each file in the build output does.

  • an index.html file that embeds your content in a web page.
  • a JavaScript file containing the code for your player.
  • a .mem file containing a binary image to initialize the heap memory for your player.
  • a .data file containing the asset data and scenes.
  • some supporting JavaScript files to initialize and load the player.

What does the .mem file do?

Also, is there any document or any other information on understand the bootstrapping and loading process (e.g: what loads what and in what order?)

The best place to look for this stuff is Emscripten itself. Its documentation can be a bit patchy but all the code is available to read so you can usually fill in the blanks.

I think the mem file mostly contains static data initializers, for all global variables in the C++ - including anything needed by libraries, class statics, and so on. That may or may not correspond exactly with statics in C# - if they are initialized by code (static constructors) then their values will likely appear in the code rather than as static data.

I actually found something about it here: http://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html#emcc-memory-init-file (under --memory-init-file)