I'd like to build and package all the ports of my Unity game through a scripting system. Linux and Windows work fine through the Unity command line options, but there is none for WebGL.
For WebGL, the only existing solution seems to be its
BuildPipeline. There is a gist with some sample code that has been referenced quit a few times. I changed its content to look like this:
BuildPipeline.BuildPlayer(scenes, "./WebGL-Test", BuildTarget.WebGL, BuildOptions.None);
and call it with
unity-editor-beta -executeMethod WebGLBuilder.build (Btw, is there a way to call this method from within Unity? It doesn't help I have to restart Unity each time I want to test if the script works). It will fail with the following error:
Assets/Scripts/WebGLBuilder.cs(18,3): error CS0103: The name `BuildPipeline' does not exist in the current context Error building Player because scripts had compiler errors
I also tried to use the
BuildPlayerOptions class instead but no success. How do I get WebGL to build automatically?