Search Unity

Build Pipeline/Command Line Builds

Discussion in 'Web' started by mittense, Apr 22, 2016.

  1. mittense

    mittense

    Joined:
    Jul 25, 2013
    Posts:
    168
    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.
     
  2. jimver004

    jimver004

    Joined:
    May 29, 2017
    Posts:
    9
    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
     
    poulad likes this.