Commandline build

From FIA Wiki
Jump to: navigation, search

Create a new class that will call BuildPipeline.BuildPlayer. It would look like this:

using UnityEditor;
using System.Collections.Generic;
using System.Linq;

public class MyBuilder
{
    private static string[] EnabledLevels()
    {
        return (from scene in EditorBuildSettings.scenes where scene.enabled select scene.path).ToArray();
    }

    public static void DevelopmentBuild()
    {
        BuildPipeline.BuildPlayer(EnabledLevels(), "Game.exe", BuildTarget.StandaloneWindows, BuildOptions.Development);
    }

}

Then, call MyBuilder.DevelopmentBuild() method from the command line:

Unity.exe -batchmode -quit -executeMethod MyBuilder.DevelopmentBuild