using UnityEditor;
using UnityEngine;
public class Build
{
static void WebGLProductionBuild()
{
// Build the player.\
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
buildPlayerOptions.scenes = new[] { "Assets/Scenes/SampleScene.unity" };
buildPlayerOptions.locationPathName = "Build";
buildPlayerOptions.target = BuildTarget.WebGL;
buildPlayerOptions.options = BuildOptions.None; // set whatever you want here
BuildPipeline.BuildPlayer(buildPlayerOptions); // apply the setting changes
Debug.Log("BuildPlayerOptions\n"
+ "Scenes: " + string.Join(",", buildPlayerOptions.scenes) + "\n"
+ "Build location: " + buildPlayerOptions.locationPathName + "\n"
+ "Options: " + buildPlayerOptions.options + "\n"
+ "Target: " + buildPlayerOptions.target);
}
}
/Applications/Unity/Hub/Editor/2021.3.28f1/Unity.app/Contents/MacOS/Unity -quit -projectPath . -batchmode -executeMethod Build.WebGLProductionBuild -logFile build.log -nographics & tail -f build.log
Unity.exe -quit -projectPath . -batchmode -executeMethod Build.WebGLProductionBuild -logFile build.log -nographics