Created
December 11, 2014 15:12
-
-
Save jagwire/0129d50778c8b4462b68 to your computer and use it in GitHub Desktop.
Unity command line script to build WebGL player
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//place this script in the Editor folder within Assets. | |
using UnityEditor; | |
//to be used on the command line: | |
//$ Unity -quit -batchmode -executeMethod WebGLBuilder.build | |
class WebGLBuilder { | |
static void build() { | |
string[] scenes = {"Assets/main.unity"}; | |
BuildPipeline.BuildPlayer(scenes, "WebGL-Dist", BuildTarget.WebGL, BuildOptions.None); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When running this script with the SampleScene plus a cube in 2019.1.0f2 on either Window or Mac the output dir is empty. If i build via the unity GUI it builds correctly. Has anyone else had this issue?
Edit:
The issue I was having was due to that fact that my output dir was different and it had a trailing "/"
eg: "WebGL-Dist/" instead of "WebGL-Dist"
Solution found here:
https://forum.unity.com/threads/unable-to-build-from-command-line.730970/