Build Pipeline/Command Line Builds

Is there any information on the actual WebGL build process as initiated from a command-line interface?

The docs didn’t seem to mention WebGL command line flags whatsoever.

I’m trying to inject some optimizations/alternate flags into the process (specifically, emscripten) to see if I can get the AST memory spikes in Chrome down.

Make a folder “Editor” withing “Assets” folder and place this (where you should replace scenes[ ] with your scenes!)

using UnityEditor;

class WebGLBuilder {
static void build() {

string[ ] scenes = {“Assets/scenes/S_MainMenu.unity”, // replace with your scenes
“Assets/scenes/S_Login.unity”,
“Assets/scenes/S_Help.unity”,
“Assets/scenes/S_1.unity”,
“Assets/scenes/S_Reward.unity”,
“Assets/scenes/S_Credits.unity”,
“Assets/scenes/S_Settings.unity”,
“Assets/scenes/S_SceneSelector.unity”};

string pathToDeploy = “builds/WebGLversion/”

BuildPipeline.BuildPlayer(scenes, pathToDeploy, BuildTarget.WebGL, BuildOptions.None);
}
}

then write from command line :

“C:\Program Files\Unity\Editor\Unity.exe” -quit -batchmode -logFile stdout.txt -executeMethod WebGLBuilder.build

1 Like