//-------------------------------------------------------------------------------------------------------------------------
    public static void Build(string config, string log_filename, BuildTarget target, string output)
    {
        BuildLogger logger = new BuildLogger(log_filename, false);

        logger.Log("Building Platform: " + target.ToString());
        logger.Log("Building Config:   " + config);
        logger.Log("");

        string[] level_list = FindScenes();
        logger.Log("Scenes to be processed: " + level_list.Length);

        foreach (string s in level_list)
        {
            string cutdown_level_name = s.Remove(s.IndexOf(".unity"));
            logger.Log("   " + cutdown_level_name);
        }

        // Make sure the paths exist before building.
        try
        {
            Directory.CreateDirectory(output);
        }
        catch
        {
            logger.Log("Failed to create directories: " + output);
        }

        string results = "";

        try
        {
            results = BuildPipeline.BuildPlayer(level_list, output, target, BuildOptions.None);
        }
        catch
        {
            logger.Log("Errors Found.");
            logger.Log(results);
            logger.Close();
        }

        logger.Log("");

        if (results.Length == 0)
            logger.Log("No Build Errors");
        else
        {
            logger.Log("Errors Found.");
            logger.Log(results);
        }

        logger.Close();
    }