Version: 2019.4
Multi-Scene editing
Batch mode and built-in coroutine compatibility

Command line arguments

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

Launching Unity

En macOS, ingrese lo siguiente a la Terminal para ejecutar Unity:

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

On Windows, type the following into the Command Prompt to launch 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 applications.

Ejecutando Unity Silenciosamente

En macOS, ingrese el siguiente a la Terminal para ejecutar de manera silenciosa 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.

On Windows, type the following into the Command Prompt to silently launch Unity:

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

Returning the license to the license server

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

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

En 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.

Opciones

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

Comando Detalles
-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> Construir un reproductor standalone Linux de 64-bit (e.g. -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> Construir un reproductor standalone Windows de 32-bit (e.g. -buildWindowsPlayer path/to/your/build.exe).
-buildWindows64Player <pathname> Construir un reproductor standalone Windows de 64-bit (e.g. -buildWindows64Player path/to/your/build.exe).
-createProject <pathname> Crear un proyecto vacío en la ruta indicada.
-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 launches only one instance of the Shader Compiler, and forces its timeout to be one hour. Useful for debugging Shader Compiler issues.
-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 continuous 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> Export a package, given a path (or set of given paths). In this example exportAssetPath is a folder (relative to to the Unity project root) to export from the Unity project, and exportFileName is the package name. Currently, this option only exports whole folders at a time. You normally need to use this command with the -projectPath argument.
-force-d3d11 (Windows only) 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 When using Metal, make the Editor use a particular GPU device by passing it the index of that GPU (macOS only).
-force-metal Make the Editor use Metal as the default graphics API (macOS only).
-force-glcore Hace que el editor utilice OpenGL 3/4 core profile para renderizar. El editor intenta utilizar la mejor versión OpenGL disponible y todas las extensiones OpenGL expuestas por los drivers de OpenGL. Si la plataforma no es soportada, Direct3D será utilizado.
-force-glcoreXY Similar a -force-glcore pero solicita una versión de contexto OpenGL especifica. Los valores aceptados para XY: 32, 33, 40, 41, 42, 43, 44 o 45.
-force-gles (Windows only) Hace que el editor utilice OpenGL para sistemas embebidos de renderizado. El editor intenta utilizar la mejor versión OpenGL ES disponible y todas las extensiones OpenGL ES expuestas por los drivers de OpenGL.
-force-glesXY (Windows only) Similar a -force-gles pero solicita una versión de contexto OpenGL ES específica. Los valores aceptados para XY: 30, 31 o 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 Haga que el editor corra como si hubiera una licencia gratuita de Unity en la maquina, incluso si una licencia Unity Pro está instalada.
-force-low-power-device (macOS only) If you use Metal, make the Editor use a low power device.
-importPackage <pathname> Importe el package dado. Ningún dialogo de importación es mostrado.
-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 Disables the Unity Package Manager.
-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.
-profiler-enable Profile the start-up of a Player or the Editor. When you use this argument with a Player, it has the same effect as building the Player with the Autoconnect Profiler option enabled in Build Settings.

When you use this argument with the Editor, it starts collecting and displaying Profiler information in the Profiler window on start-up of the Editor.
-profiler-log-file <Path/To/Log/File.raw> This argument sets up the Unity Profiler to stream the profile data to a .raw file on startup. It works for both Players and the Editor.
-profiler-capture-frame-count <NumberOfFrames> This argument sets how many frames the Profiler should capture in a profile when streaming to a .raw file on start-up. It only works on Players.
-profiler-maxusedmemory By default, maxUsedMemory for the Unity Profiler is 16MB for Players and 256MB for the Editor. You can use this argument to set the maxUsedMemory parameter to a custom size at start-up (for example, -profiler-maxusedmemory 16777216). The size is set in bytes.
-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. You 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 Prevent Unity from displaying the dialog that appears when a Standalone Player crashes. This argument is useful when you want to run the Player in automated builds or tests, where you don’t want a dialog prompt to obstruct automation.
-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 modes are "Visible Meta Files", "Hidden Meta Files", Perforce, and PlasticSCM. Additional flags can be used to fill out the configuration fields for the given version control mode. These flags are based on the Provider.GetActiveConfigFields method. For example, you can use the -vcPerforceUsername, -vcPerforcePassword, -vcPerforceWorkspace and -vcPerforceServer to set the Perforce username, workspace and server fields.

Note: <mode> arguments that contain spaces must be wrapped in double quotes (").
-EnableCacheServer Tells Unity to enable usage of the newer Accelerator Cache Server. You must also use -cacheServerEndpoint to specify the address.
-cacheServerEndpoint Specifies the endpoint address if you are using the newer Accelerator Cache Server.

Example:

-cacheServerEndpoint 127.0.0.1:10080. This overrides any configuration stored in the Editor Preferences. Use this to connect multiple instances of Unity to different Cache Servers.
-cacheServerNamespacePrefix Set the namespace prefix for the newer Accelerator Cache Server. Used to group data together on the Cache Server.

Example:

-cacheServerNamespacePrefix MyProject
-cacheServerEnableDownload Enable downloading from the newer Accelerator Cache Server.

Example:

-cacheServerEnableDownload true
-cacheServerEnableUpload Enable uploading to the newer Accelerator Cache Server.

Example:

-cacheServerEnableUpload false
-CacheServerIPAddress <host:port> Enables usage of the older (v1) Cache Server, and specifies the IP Address to connect to on startup. This overrides any configuration stored in the Editor Preferences. Use this to connect multiple instances of Unity to different v1 Cache Servers.

Ejemplo de uso

C# script in the project:

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

The following command executes Unity in batch mode, executes the MyEditorScript.PerformBuild method, and then quits upon completion. Because the

Windows:

"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -projectPath "C:\Users\UserName\Documents\MyProject" -executeMethod MyEditorScript.PerformBuild

Mac OS:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath ~/UnityProjects/MyProject -executeMethod MyEditorScript.PerformBuild

Argumentos de línea de comandos especiales para el Editor de Unity

You should only use these under special circumstances, or when directed by Unity Support.

Comando Detalles
-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.

Argumentos de línea de comandos para un Reproductor Standalone de Unity

Los reproductores Standalone construidos con Unity también entienden algunos argumentos de linea de comando:

Comando Detalles
-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 only) Haga que el juego utilice Direct3D 11 para renderizar.
-force-d3d11-singlethreaded Force DirectX 11.0 to be created with a D3D11_CREATE_DEVICE_SINGLETHREADED flag.
-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 Vulkan graphics APIs, but is not supported for OpenGL.
-force-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 Similar a -force-glcore pero solicita una versión de contexto OpenGL especifica. Los valores aceptados para XY: 32, 33, 40, 41, 42, 43, 44 o 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 Activate experimental Wayland support when running a Linux player.
-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.
-no-stereo-rendering Turn off stereo rendering.
-parentHWND <HWND> delayed (Windows only) 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 Create the window as a a pop-up window, without a frame. This command is not supported on macOS.
-screen-fullscreen Anula el estado por defecto de pantalla completa. Este debe ser 0 o 1.
-screen-height Anula la altura de la pantalla predetermina. Este debe ser un entero de una resolución soportada.
-screen-width Anula la anchura de pantalla predeterminada. Este debe ser un entero de una resolución soportada.
-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.
-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.

Universal Windows Platform command line arguments

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");

You should call this before the appCallbacks.Initialize() function.

Comando Detalles
-nolog No generar UnityPlayer.log.
-force-driver-type-warp Obliga el dispositivo WARP DIrectX 11.0 http://msdn.microsoft.com/en-us/library/gg615082.aspx)
-force-d3d11-singlethreaded Force DirectX 11.0 to be created with a D3D11_CREATE_DEVICE_SINGLETHREADED flag.
-force-gfx-direct Forzar renderización en un solo hilo.
-force-feature-level-9-3 Obliga DirectX 11.0 al nivel de características 9.3.
-force-feature-level-10-0 Obliga DirectX 11.0 al nivel de características 10.0.
-force-feature-level-10-1 Obliga DirectX 11.0 al nivel de características 10.1.
-force-feature-level-11-0 Obliga DirectX 11.0 al nivel de características 11.0.

  • 2019–04–18 Page amended

  • “accept-apiupdate” command line option added in Unity 2017.2 NewIn20172

  • “-force-clamped” command line argument added in Unity 2017.3 NewIn20172

  • Soporte Tizen descontinuado en 2017.3 NewIn20173

  • “noUpm”, “setDefaultPlatformTextureFormat” and “CacheServerIPAddress” command line options added in Unity 2018.1 NewIn20181

  • “Application.isBatchMode” operator added in 2018.2 NewIn20182

Multi-Scene editing
Batch mode and built-in coroutine compatibility
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961