Version: 2018.4
Construir el Pipeline de un Reproductor
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).

On macOS, type the following into the Terminal to launch 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 it like this, Unity 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.

Ejecutando Unity Silenciosamente

On macOS, type the following into the Terminal to silently launch Unity:

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

Note: When activating via the command line using continuous integration (CI) tools like Jenkins, 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" -quit -batchmode -serial SB-XXXX-XXXX-XXXX-XXXX-XXXX -username "JoeBloggs@example.com" -password "MyPassw0rd"

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

On Windows, type the following into the Command Prompt to return the license:

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

Create 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

Check Manual Activation Guide for more details. ​

Opciones

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

Comando Detalles
-assetServerUpdate <IP[:port] projectName username password [r <revision>]> Force an update of the project in the Asset Server given by IP:port. The port is optional, and if not given it is assumed to be the standard one (10733). It is advisable to use this command in conjunction with the -projectPath argument to ensure you are working with the correct project. If you don’t give a project name, then the command line uses the last project opened by Unity. If no project exists at the path -projectPath gives, then the command line creates one automatically.
-batchmode Run Unity in batch mode. You should always use this in conjunction with the other command line arguments, because it ensures no pop-up windows appear and eliminates 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.
Tip: To check whether you are running the Editor or Standalone Player 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 when using -batchmode, use the -buildTarget option.
-buildLinux32Player <pathname> Construir un reproductor standalone Linux de 32-bit (e.g. -buildLinux32Player path/to/your/build).
-buildLinux64Player <pathname> Construir un reproductor standalone Linux de 64-bit (e.g. -buildLinux64Player path/to/your/build).
-buildLinuxUniversalPlayer <pathname> Construir un reproductor standalone Linux combinado de 32-bit y 64-bit (e.g. -buildLinuxUniversalPlayer path/to/your/build).
-buildOSXPlayer <pathname> Construir un reproductor standalone Mac de 32-bit (e.g. -buildOSXPlayer path/to/your/build.app).
-buildOSX64Player <pathname> Construir un reproductor standalone Mac de 64-bit (e.g. -buildOSX64Player path/to/your/build.app).
-buildOSXUniversalPlayer <pathname> Construir un reproductor standalone Mac combinado de 32-bit y de 64-bit (e.g. -buildOSXUniversalPlayer path/to/your/build.app).
-buildTarget <name> Allows the selection of an active build target before loading a project. Possible options are:
standalone, Win, Win64, OSXUniversal, Linux, Linux64, LinuxUniversal, iOS, Android, Web, WebStreamed, WebGL, XboxOne, PS4, WindowsStoreApps, Switch, N3DS, 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).
-stackTraceLogType Detailed debugging feature. StackTraceLogging allows you to allow detailed logging. All settings allow None, Script Only and Full to be selected. (for example, -stackTraceLogType Full)
-CacheServerIPAddress <host:port> Connect to the specified Cache Server on startup, overriding any configuration stored in the Editor Preferences. Use this to connect multiple instances of Unity to different Cache Servers.
-createProject <pathname> Crear un proyecto vacío en la ruta indicada.
-editorTestsCategories Filtra las pruebas del editor por categorías. Separe las categorías de prueba con una coma.
-editorTestsFilter Filtra las pruebas del editor por nombres. Separe los nombres de las pruebas con una coma.
-editorTestsResultFile Path location to place the result file. If the path is a folder, the command line uses a default file name. If not specified, it places the results in the project’s root folder.
-executeMethod <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> 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-device-index When using Metal, make the Editor use a particular GPU device by passing it the index of that GPU (macOS only).
-force-gfx-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-clamped Utilizado en conjunto con -force-glcoreXY, pero previene la revisión de extensiones adicionales OpenGL permitiendo que haya una ejecución entre plataformas con las mismas rutas de código
-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 When using Metal, make the Editor use a low power device (macOS only).
-importPackage <pathname> Importe el package dado. Ningún dialogo de importación es mostrado.
-logFile <pathname> Specify where the Editor or Windows/Linux/OSX standalone log file are written. If the path is ommitted, OSX and Linux will write output to the console. Windows uses the path %LOCALAPPDATA%\Unity\Editor\Editor.log as a default.
-nographics When running in batch mode, do not initialize the graphics device at all. This makes it possible to run your automated workflows on machines that don’t even have a GPU (automated workflows only work when you have a window in focus, otherwise you can’t send simulated input commands). Note that -nographics does not allow you to bake GI, because Enlighten requires GPU acceleration.
-noUpm Disables the Unity Package Manager.
-password <password> Enter a password into the log-in form during activation of the Unity Editor.
-projectPath <pathname> Abrir el proyecto en la ruta indicada.
-quit Salga del editor de Unity después de que otros comandos hayan terminado de ejecutarse. Tenga en cuenta que esto puede hacer que los mensajes de error no se muestren (pero se pueden ver en el archivo Editor.log).
-returnlicense Retorna la licencia actualmente activa al license server. Por favor permita unos pocos segundos antes de que el archivo de licencia sea removido, ya que Unity necesita comunicarse con el licences server. Esta opción es nueva en Unity 5.0.
-runEditorTests Corra pruebas del editor del proyecto. Este argumento requiere projectPath y es bueno para correr con el argumento batchmode. quit no se requiere ya que el editor va a cerrarse automáticamente después de que run haya terminado.
-serial <serial> Activa Unity con la clave serial especificada. Es recomendado pasar los argumentos “-batchmode -quit” también, con el fin de salirse de Unity cuando finalice, si se está utilizando esta activación de Unity automatizada. Por favor permítale unos segundos antes de que el archivo de licencia sea creado, ya que Unity necesita comunicarse con el license server. Asegúrese de que la la carpeta para el archivo de la licencia exista y tenga unos permisos apropiados antes de ejecutar Unity con este argumento. En caso de que la activación falle, ver el Editor.log para más información. Esta opción es nueva en Unity 5.0.
-setDefaultPlatformTextureFormat Sets the default texture compression to the desired format before importing a texture or building 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.
Note that this is only supported on Android.
-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.
-username <username> Ingresa un username al formulario de log in durante la activación del Editor de Unity.
-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 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:

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

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 game 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.
-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]

Omitting this command line argument when launching Unity in batch mode results in APIUpdater not running which can lead to compiler errors. Note that in versions prior to 2017.2 there’s no way to not run APIUpdater when Unity is launched in batch mode.

Ejemplo de uso

C#:

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.

-popupwindow

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

The following command executes Unity in batch mode, and updates from the Asset server using the supplied project path. The method executes after all Assets are downloaded and imported from the Asset server. After the function has finished execution, Unity automatically quits.

/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -projectPath ~/UnityProjects/AutobuildProject -assetServerUpdate 192.168.1.1 MyGame AutobuildUser l33tpa33 -executeMethod MyEditorScript.PerformBuild -quit

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 Utilice cuando usted tenga contenido hecho por una nueva, incompatible versión de Unity, la cual usted quiere bajar para que funcione con su versión actual de Unity. Cuando esté activado, Unity va a presentarle un dialogo preguntando para una confirmación de tal downgrade si usted intenta abrir un proyecto que lo requiera. Este procedimiento no es soportado y es de alto riesgo, y solo debe ser utilizado como último recurso.

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
-adapter N (Windows only) Le permite al juego correr pantalla completa en otra pantalla. El N mapea a un adaptador de pantalla Direct3D. En la mayoría de casos hay una relación uno-a-uno entre los adaptadores y las tarjetas de videos. En las tarjetas que soportan multi-head (pueden manejar múltiples monitores en una sola tarjeta) cada “head” puede tener su propio adaptador.
-batchmode Run the game in “headless” mode. The game does not display anything or accept user input. This is mostly 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-device-index Make the Standalone Player use a particular GPU device by passing it the index of that GPU (macOS only).
-force-gfx-metal Make the Standalone Player use Metal as the default graphics API (macOS only).
-force-glcore Force the Editor 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-clamped Utilizado en conjunto con -force-glcoreXY, pero previene la revisión de extensiones adicionales OpenGL permitiendo que haya una ejecución entre plataformas con las mismas rutas de código
-force-low-power-device Make the Standalone Player use a low power device (macOS only).
-force-wayland Activate experimental Wayland support when running a Linux player.
-nographics Cuando se corra en batch mode, no inicialize el dispositivo gráfico en absoluto. Esto hace que sea posible ejecutar sus flujos de trabajo automatizados en maquinas que no tienen un GPU.
-nolog (Linux & Windows only) No produzca un output de registro (log). Normalmente output_log.txt es escrito en la carpeta *_Data alado del ejecutable del juego, dónde el output Debug.Log es imprimido.
-popupwindow La ventana será creada como una ventana emergente (sin un frame).
-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 Anula la calidad e la pantalla predeterminada. Un uso de ejemplo sería: /path/to/myGame -screen-quality Beautiful
-show-screen-selector Obliga al dialogo selector de la pantalla en ser mostrado.
-single-instance (Linux & Windows only) Permite solo una instancia del juego a correr a la vez. Si otra instancia ya está corriendo entonces lanzando nuevamente -single-instance va a enfocarse en la existente.
-parentHWND <HWND> delayed (Windows only) Embed the Windows Standalone application into another application. When using this, you need to pass the parent application’s window handle (‘HWND’) to the Windows Standalone application.

When passing -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 graphics have been initialized and it’s safe to resize. Its second lowest bit is set to 1 after the Unity splash screen has finished displaying.
For more information, see this example: EmbeddedWindow.zip

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-no-singlethreaded Obliga a DirectX 11.0 en ser creado sin una flag D3D11_CREATE_DEVICE_SINGLETHREADED.
-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.

  • 2018–09–07 Page amended with limited editorial review

  • “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

Construir el Pipeline de un Reproductor
Batch mode and built-in coroutine compatibility