Advanced Editor Topics
커맨드라인 인수

Build Player 파이프라인

플레이어를 빌드할 때, 사용자 지정 아이콘을 추가 하거나, 몇 개의 문서를 플레이어 빌드 후 복사하거나, 인스톨러를 구축하는 등의 수정을 원할 경우가 있을지도 모릅니다. 이들은 에디터 스크립트의 [BuildPipeline.BuildPlayer](ScriptRef : BuildPipeline.BuildPlayer.html)를 사용하여 빌드한 후 필요한 처리를 코드로 작성할 수 있습니다 : -

// JS example.

import System.Diagnostics;

class ScriptBatch {
    @MenuItem("MyTools/Windows Build With Postprocess")
    static function BuildGame() {
        // Get filename.
        var path = EditorUtility.SaveFolderPanel("Choose Location of Built Game", "", "");
        var levels : String[] = ["Assets/Scene1.unity", "Assets/Scene2.unity"];
        
        // Build player.
        BuildPipeline.BuildPlayer(levels, path + "/BuiltGame.exe", BuildTarget.StandaloneWindows, BuildOptions.None);

        // Copy a file from the project folder to the build folder, alongside the built game.
        FileUtil.CopyFileOrDirectory("Assets/WebPlayerTemplates/Readme.txt", path + "Readme.txt");

        // Run the game (Process class from System.Diagnostics).
        var proc = new Process();
        proc.StartInfo.FileName = path + "BuiltGame.exe";
        proc.Start();
    }
}


// C# example.
using UnityEditor;
using System.Diagnostics;

public class ScriptBatch 
{
    [MenuItem("MyTools/Windows Build With Postprocess")]
    public static void BuildGame ()
    {
        // Get filename.
        string path = EditorUtility.SaveFolderPanel("Choose Location of Built Game", "", "");
        string[] levels = new string[] {"Assets/Scene1.unity", "Assets/Scene2.unity"};

        // Build player.
        BuildPipeline.BuildPlayer(levels, path + "/BuiltGame.exe", BuildTarget.StandaloneWindows, BuildOptions.None);

        // Copy a file from the project folder to the build folder, alongside the built game.
        FileUtil.CopyFileOrDirectory("Assets/WebPlayerTemplates/Readme.txt", path + "Readme.txt");

        // Run the game (Process class from System.Diagnostics).
        Process proc = new Process();
        proc.StartInfo.FileName = path + "BuiltGame.exe";
        proc.Start();
    }
}

# PostProcessBuild 속성

You can also use the postprocessOrder parameter of the PostProcessBuildAttribute to define the execution order for your build methods, and call your external scripts with the Process class from these methods as shown in the last section. This parameter is used to sort the build methods from lower to higher, and you can assign any negative or positive value to it.

Advanced Editor Topics
커맨드라인 인수