플레이어 빌드 파이프라인
배치 모드 및 빌트인 코루틴 호환성

커맨드 라인 인자

You can run Unity from the command line (from the macOS Terminal or the Windows Command Prompt).

Launching Unity

Mac OS의 경우, 다음을 터미널에 입력하여 Unity를 실행해야 합니다.

/Applications/Unity/Unity.app/Contents/MacOS/Unity

Windows의 경우, 다음을 커맨드 프롬프트에 입력하여 Unity를 실행해야 합니다.

"C:\Program Files\Unity\Editor\Unity.exe"

When you launch Unity like this, it receives commands and information on startup, which can be very useful for test suites, automated builds and other production tasks. Note: Use the same method to launch standalone Unity games.

Unity 자동 실행

Mac OS의 경우, 다음을 터미널에 입력하여 Unity를 자동으로 실행해야 합니다.

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial SB-XXXX-XXXX-XXXX-XXXX-XXXX -username 'JoeBloggs@example.com' -password 'MyPassw0rd'

Note: If you use continuous integration (CI) tools like Jenkins to activate via the command line, add the -nographics flag to prevent a WindowServer error.

Windows의 경우, 다음을 커맨드 프롬프트에 입력하여 Unity를 자동으로 실행해야 합니다.

"C:\Program Files\Unity\Editor\Unity.exe" -batchmode -username name@example.edu.uk - password XXXXXXXXXXXXX -serial E3-XXXX-XXXX-XXXX-XXXX-XXXX –quit

라이선스 서버로 라이선스 반환

On macOS, type the following into the Terminal to return the license:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -returnlicense

Windows:

"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -returnlicense

Returning the license is useful when you no longer want to use Unity on the machine, and want to use the same license on another machine.

Create a license activation file and import license file by command

On macOS, type the following into the Terminal:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -createManualActivationFile -logfile

/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -manualLicenseFile <yourulffile> -logfile

On Windows, type the following into the Command Prompt:

"C:\Program Files\Unity\Editor\Unity.exe" -batchmode -createManualActivationFile -logfile

"C:\Program Files\Unity\Editor\Unity.exe" -batchmode -manualLicenseFile <yourulffile> -logfile

For more details, read the Manual Activation Guide.

옵션

You can run the Editor and built Unity applications with additional commands and information on startup. This section describes the command line options available.

커맨드 세부 정보
-accept-apiupdate Use this command line option to specify that APIUpdater should run when Unity is launched in batch mode.

Example:

unity.exe -accept-apiupdate -batchmode [other params]

The APIUpdater will not run if you omit this command line argument when you launch Unity in batch mode. This can lead to compiler errors.
-batchmode Run Unity in batch mode. Always use this in conjunction with the other command line arguments to ensure no pop-up windows appear and eliminate the need for any human intervention. When an exception occurs during execution of the script code, the Asset server updates fail, or other operations fail, Unity immediately exits with return code 1.

Note that in batch mode, Unity sends a minimal version of its log output to the console. However, the Log Files still contain the full log information. You cannot open a project in batch mode while the Editor has the same project open; only a single instance of Unity can run at a time.

To check whether the Editor or Standalone Player is running in batch mode, use the Application.isBatchMode operator.

If the project has not yet been imported when using -batchmode, the target platform is the default one. To force a different platform, use the -buildTarget option.
-buildLinux64Player <pathname> 64비트 스탠드얼론 Linux 플레이어를 빌드합니다(예: -buildLinux64Player path/to/your/build).
-buildOSXUniversalPlayer <pathname> Build a 64-bit standalone Mac OSX player (for example, -buildOSXUniversalPlayer path/to/your/build.app).
-buildTarget <name> Select an active build target before loading a project. Possible options are:
Standalone, Win, Win64, OSXUniversal, Linux64, iOS, Android, WebGL, XboxOne, PS4, WindowsStoreApps, Switch, tvOS.
-buildWindowsPlayer <pathname> 32비트 스탠드얼론 Windows 플레이어를 빌드합니다(예: -buildWindowsPlayer path/to/your/build.exe).
-buildWindows64Player <pathname> 64비트 스탠드얼론 Windows 플레이어를 빌드합니다(예: -buildWindows64Player path/to/your/build.exe).
-CacheServerIPAddress <host:port> Connect to the Cache Server you specify on startup, overriding any configuration stored in the Editor Preferences. Use this to connect multiple instances of Unity to different Cache Servers.
-createProject <pathname> 주어진 경로에 빈 프로젝트를 생성합니다.
-deepprofiling Enable Deep Profiling option for the CPU profiler.
-disable-assembly-updater <assembly1 assembly2> Specify a space-separated list of assembly names as parameters for Unity to ignore on automatic updates.
The space-separated list of assembly names is optional: pass the command line options without any assembly names to ignore all assemblies, as in example 1.

Example 1
unity.exe -disable-assembly-updater

Example 2
unity.exe -disable-assembly-updater A1.dll subfolder/A2.dll

Example 2 has two assembly names, one with a pathname. Example 2 ignores A1.dll, no matter what folder it is stored in, and ignores A2.dll only if it is stored under subfolder folder:

If you list an assembly in the -disable-assembly-updater command line parameter (or if you don’t specify assemblies), Unity logs the following message to Editor.log:

[Assembly Updater] warning: Ignoring assembly [assembly_path] as requested by command line parameter.").

Use this to avoid unnecessary API Updater overheads when importing assemblies.

It is useful for importing assemblies which access a Unity API when you know the Unity API doesn’t need updating. It is also useful when importing assemblies which do not access Unity APIs at all (for example, if you have built your source code, or some of it, outside of Unity, and you want to import the resulting assemblies into your Unity project).

Note: If you disable the update of any assembly that does need updating, you may get errors at compile time, run time, or both, that are hard to track.
-diag-debug-shader-compiler Unity는 셰이더 컴파일러의 인스턴스를 하나만 시작한 후 타임아웃을 1시간으로 강제 설정합니다. 이는 셰이더 컴파일러 문제를 디버깅할 때 유용합니다.
-enableCodeCoverage Enables code coverage and allows access to the Coverage API.
-executeMethod <ClassName.MethodName> or -executeMethod <NamespaceName.ClassName.MethodName> Execute the static method as soon as Unity opens the project, and after the optional Asset server update is complete. You can use this to do tasks such as continous integration, performing Unit Tests, making builds or preparing data. To return an error from the command line process, either throw an exception which causes Unity to exit with return code 1, or call EditorApplication.Exit with a non-zero return code. To pass parameters, add them to the command line and retrieve them inside the function using System.Environment.GetCommandLineArgs. To use -executeMethod, you need to place the enclosing script in an Editor folder. The method you execute must be defined as static.
-exportPackage <exportAssetPath1 exportAssetPath2 ExportAssetPath3 exportFileName> 경로(특정 경로 세트)를 지정해 패키지를 익스포트합니다. 이 예에서 exportAssetPath는 Unity 프로젝트에서 익스포트할 폴더(Unity 프로젝트 루트와 관련됨)이고 exportFileName은 패키지 이름입니다. 현재 이 옵션은 한 번에 전체 폴더만 익스포트할 수 있습니다. 일반적으로 이 커맨드는 -projectPath 인자와 함께 사용해야 합니다.
-force-d3d11 (Windows 전용) Make the Editor use Direct3D 11 for rendering. Normally the graphics API depends on Player Settings (typically defaults to D3D11).
-force-d3d12 (Windows only) Make the Editor use Direct3D 12 for rendering. Normally the graphics API depends on Player Settings.
-force-device-index Metal을 사용하는 경우 특정 GPU의 인덱스에 전달하여 에디터가 해당 GPU 기기를 사용하도록 합니다(macOS 전용).
-force-gfx-metal 에디터가 Metal을 기본 그래픽스 API로 사용하도록 합니다(macOS 전용).
-force-glcore 렌더링 시 에디터에서 OpenGL 3/4 코어 프로파일을 사용하도록 합니다. 에디터는 가능한 OpenGL 최상위 버전 및 OpenGL 드라이버에 의해 노출되는 모든 OpenGL 익스텐션을 사용하려고 합니다. 플랫폼이 지원되지 않을 경우 Direct3D가 사용됩니다.
-force-glcoreXY -force-glcore와 비슷하나, 특정 OpenGL 컨텍스트 버전을 요청합니다. XY에 들어갈 수 있는 값은 다음과 같습니다. 32, 33, 40, 41, 42, 43, 44 또는 45.
-force-gles (Windows 전용) 렌더링 시 에디터에서 임베디드 시스템용 OpenGL을 사용하도록 합니다. 에디터는 가능한 OpenGL ES 최상위 버전 및 OpenGL 드라이버에 의해 노출되는 모든 OpenGL ES 익스텐션을 사용하려고 합니다.
-force-glesXY (Windows 전용) -force-gles와 비슷하나, 특정 OpenGL ES 컨텍스트 버전을 요청합니다. XY에 들어갈 수 있는 값은 다음과 같습니다. 30, 31 또는 32.
-force-vulkan Make the Editor use Vulkan for rendering. Normally the graphics API depends on Player Settings.
-force-clamped Use this with -force-glcoreXY to prevent Unity from checking for additional OpenGL extensions, allowing it to run between platforms with the same code paths.
-force-free Unity Pro 라이선스가 설치되어 있어도 시스템에 무료 Unity 라이선스가 설치된 것처럼 에디터를 실행합니다.
-force-low-power-device (macOS only) If you use Metal, make the Editor use a low power device.
-importPackage <pathname> 주어진 패키지를 임포트합니다. 임포트 다이얼로그는 표시되지 않습니다.
-job-worker-count <N> Specify the maximum thread count for the Unity JobQueue Job Worker Count. You can also specify it as job-worker-count=<N> in boot.config for the Unity Standalone Player.
-logFile <pathname> Specify where Unity writes the Editor or Windows/Linux/OSX standalone log file. To output to the console, specify - for the path name. On Windows, specify - option to make the output go to stdout, which is not the console by default.
-nographics When you run this in batch mode, it does not initialize the graphics device. You can then run automated workflows on machines that don’t have a GPU. Automated workflows only work when you have a window in focus, otherwise you can’t send simulated input commands. -nographics does not allow you to bake GI as Enlighten requires GPU acceleration.
-noUpm Unity 패키지 관리자를 비활성화합니다.
-openfile <path> Open the project from a path to a scene or package file. Alternative is to use -projectPath argument.
-password <password> Enter a password into the log-in form during the activation of the Unity Editor.
-projectPath <pathname> Open the project at the given path. If pathname contains spaces, enclose it in quotes.
-quit Quit the Unity Editor after other commands have finished executing. This can cause error messages to be hidden (however, they still appear in the Editor.log file).
-returnlicense Return the currently active license to the license server. You should wait a few seconds before Unity removes the license file, because it needs to communicate with the license server.
-serial <serial> Activate Unity with the specified serial key. When you use this to automatically activate Unity, you must pass the -batchmode, and it is good practice to pass the -quit argument. ou should wait a few seconds before Unity removes the license file, because it needs to communicate with the license server. Make sure that license file folder exists, and it has appropriate permissions before you run Unity with this argument. If activation fails, see the Editor.log for info.
-setDefaultPlatformTextureFormat (Android only) Set the default texture compression to the desired format before you import a texture or build the project. This is so you don’t have to import the texture again with the format you want. The available formats are dxt, pvrtc, atc, etc, etc2, and astc.
-silent-crashes 이 옵션을 선택하면 스탠드얼론 플레이어에서 충돌이 발생할 때 나타나는 다이얼로그가 Unity에 표시되지 않습니다. 이 인자는 자동 빌드 또는 테스트에서 플레이어를 실행하려는 경우에 유용합니다. 이러한 경우에는 다이얼로그가 표시되면 자동화가 중단될 수 있습니다.
-stackTraceLogType Allow detailed debugging. All settings allow None, Script Only and Full to be selected. (for example, -stackTraceLogType Full)
-testPlatform, -testResults, -runTests Run tests. See Unity Test Runner documentation.
-username <username> Enter a username into the log-in form during the activation of the Unity Editor.
-vcsMode <mode> Set version control mode for this session. Available mode are Visible Meta Files, Hidden Meta Files, Perforce and PlasticSCM

예제

C# script in the project:

using UnityEditor;
class MyEditorScript
{
     static void PerformBuild ()
     {
         string[] scenes = { "Assets/MyScene.unity" };
         BuildPipeline.BuildPlayer(scenes, ...);
     }
}

다음 커맨드는 Unity를 배치 모드로 실행하고 MyEditorScript.PerformBuild 메서드를 실행한 다음 완료되면 종료합니다.

Windows:

"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -executeMethod MyEditorScript.PerformBuild

Mac OS:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -executeMethod MyEditorScript.PerformBuild

Unity 에디터 특수 커맨드 라인 인자

특수한 상황에서 또는 Unity 지원팀의 지시에 따라서만 이러한 커맨드 라인 인자를 사용해야 합니다.

커맨드 세부 정보
-enableIncompatibleAssetDowngrade Use this when you have Assets made by a newer, incompatible version of Unity, that you want to downgrade to work with your current version of Unity. When you enable this, Unity presents you with a dialog asking for confirmation of this downgrade if you attempt to open a project that would require it.
Note: This procedure is unsupported and highly risky, and should only be used as a last resort.

Unity 스탠드얼론 플레이어 커맨드 라인 인자

Unity로 빌드한 스탠드얼론 플레이어 또한 몇몇 커맨드 라인 인자를 파악할 수 있습니다.

커맨드 세부 정보
-monitor N Run Standalone Player on the specified monitor, indicated by a 1-based index number.
-batchmode Run the game in “headless” mode. The game does not display anything or accept user input. This is useful for running servers for networked games.
-force-d3d11 (Windows 전용) 게임이 렌더링에 Direct3D 11을 사용하도록 합니다.
-force-d3d11-singlethreaded DirectX 11.0을 D3D11_CREATE_DEVICE_SINGLETHREADED 플래그 없이 강제로 생성되도록 합니다.
-force-d3d12 (Windows only) Force the game to use Direct3D 12 for rendering.
-force-device-index Make the Standalone Player use a particular GPU device by passing it the index of that GPU. This option is supported for D3D11, D3D12, Metal, and Vulcan graphics APIs, but is not supported for OpenGL.
-force-gfx-metal (macOS only) Make the Standalone Player use Metal as the default graphics API.
-force-glcore Force the game to use OpenGL core profile for rendering. The Editor tries to use the best OpenGL version available, and all OpenGL extensions exposed by the OpenGL drivers. If the platform isn’t supported, Direct3D is used.
-force-glcoreXY -force-glcore와 비슷하나, 특정 OpenGL 컨텍스트 버전을 요청합니다. XY에 들어갈 수 있는 값은 다음과 같습니다. 32, 33, 40, 41, 42, 43, 44 또는 45.
-force-vulkan Force the game to use Vulkan for rendering.
-force-clamped Use this together with -force-glcoreXY to prevent checking for additional OpenGL extensions, allowing it to run between platforms with the same code paths.
-force-low-power-device (macOS only) Make the Standalone Player use a low power device.
-force-wayland Linux 플레이어 실행 시 실험 단계인 Wayland 지원을 활성화합니다.
-nographics When you run this in batch mode, it does not initialize a graphics device. This makes it possible to run your automated workflows on machines that don’t have a GPU.
-nolog Do not produce an output log. Normally Unity writes the output_log.txt in the Log Files folder, where the Debug.Log output is printed.
-parentHWND <HWND> delayed (Windows 전용) Embed the Windows Standalone application into another application. When you use this, you need to pass the parent application’s window handle (‘HWND’) to the Windows Standalone application.

When you pass -parentHWND 'HWND' delayed, the Unity application is hidden while it is running. You must also call SetParent from the Microsoft Developer library for Unity in the application. Microsoft’s SetParent embeds the Unity window. When it creates Unity processes, the Unity window respects the position and size provided as part of the Microsoft’s STARTUPINFO structure.

To resize the Unity window, check its GWLP_USERDATA in Microsoft’s GetWindowLongPtr function. Its lowest bit is set to 1 when the graphics initialize and it’s safe to resize. Its second lowest bit is set to 1 after the Unity splash screen finishes displaying.
For more information, see this example: EmbeddedWindow.zip
-popupwindow 창을 프레임이 없는 팝업 창으로 만듭니다. 이 커맨드는 macOS에서 지원되지 않습니다.
-screen-fullscreen 디폴트 풀스크린 상태를 오버라이드합니다. 이 값은 반드시 0 또는 1이어야 합니다.
-screen-height 디폴트 스크린 높이를 오버라이드합니다. 이 값은 반드시 지원되는 해상도에 해당하는 정수여야 합니다.
-screen-width 디폴트 스크린 폭을 오버라이드합니다. 이 값은 반드시 지원되는 해상도에 해당하는 정수여야 합니다.
-screen-quality Override the default screen quality. Example usage would be: /path/to/myGame -screen-quality Beautiful. The supported options match the Quality Settings names.
-show-screen-selector 스크린 셀렉터 다이얼로그가 강제로 나타나도록 합니다.
-single-instance (Linux and Windows only) Run only one instance of the application at the time. If another instance is already running then launching it again with -single-instance focuses the existing one.
-vrmode <devicetype> Launch with a specific VR device. See Virtual Reality for details.
-window-mode (Windows only) Override fullscreen windowing mode. Accepted values are exclusive or borderless. See Standalone Player settings for details.

유니버설 Windows 플랫폼 커맨드 라인 인자

Universal Windows Apps don’t accept command line arguments by default, so to pass them you need to call a special function from MainPage.xaml.cs/cpp or MainPage.cs/cpp. For example:

appCallbacks.AddCommandLineArg("-nolog");

이 함수는 appCallbacks.Initialize*() 함수 이전에 호출해야 합니다.

커맨드 세부 정보
-nolog UnityPlayer.log를 생성하지 않습니다.
-force-driver-type-warp DirectX 11.0 드라이버 타입의 WARP 장치를 사용하도록 합니다. 자세한 내용은 Microsoft의 Windows Advanced Rasterization Platform 문서를 참조하십시오.
-force-d3d11-singlethreaded DirectX 11.0을 D3D11_CREATE_DEVICE_SINGLETHREADED 플래그 없이 강제로 생성되도록 합니다.
-force-gfx-direct 단일 스레드 렌더링을 강제로 사용하도록 합니다.
-force-feature-level-9-3 DirectX 11.0 기능 레벨 9.3을 강제로 사용하도록 합니다.
-force-feature-level-10-0 DirectX 11.0 기능 레벨 10.0을 강제로 사용하도록 합니다.
-force-feature-level-10-1 DirectX 11.0 기능 레벨 10.1을 강제로 사용하도록 합니다.
-force-feature-level-11-0 DirectX 11.0 기능 레벨 11.0을 강제로 사용하도록 합니다.

  • 2019–04–18 Page amended

  • “accept-apiupdate” 커맨드 라인 옵션이 Unity 2017.2에 추가됨 NewIn20172

  • “-force-clamped” 커맨드 라인 인자가 Unity 2017.3에 추가됨 NewIn20172

  • 2017.3에서 Tizen 지원 중단됨 NewIn20173

  • Unity 2018.1에서 “noUpm”, “setDefaultPlatformTextureFormat” 및 “CacheServerIPAddress” 커맨드 라인 옵션 추가됨 NewIn20181

  • “Application.isBatchMode” operator added in 2018.2 NewIn20182

플레이어 빌드 파이프라인
배치 모드 및 빌트인 코루틴 호환성