macOS で Unity を起動するには、以下をターミナルに入力します。
/Applications/Unity/Hub/Editor/<version>/Unity.app/Contents/MacOS/Unity -projectPath <project path>
On Linux, type the following into the Terminal to launch Unity:
/Applications/Unity/Hub/Editor/<version>/Unity.app/Contents/Linux/Unity -projectPath <project path>
Windows で Unity を起動するには、以下をコマンドプロンプトに入力します。
"C:\Program Files\Unity\Hub\Editor\<version>\Editor\Unity.exe" -projectPath "<project path>"
When you launch Unity like this, it receives commands and information on startup, which can be useful for test suites, automated builds and other production tasks.
You can run the Editor and build Unity applications with additional commands and information on startup. This page lists the command line arguments you can use to launch and configure a Unity Editor instance.
オプション | 詳細 |
---|---|
-createProject <pathname> |
特定のパスに空のプロジェクトを作成 |
-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 overhead when you import assemblies. This argument is useful if you want to import assemblies that access a Unity API which doesn’t need updating. It’s also useful when you import assemblies which don’t access any Unity APIs (for example, if you have built some or all of your source code 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 needs updating, you might get errors at compile time, run time, or both, that are hard to track. |
-disable-gpu-skinning |
Disable Graphics Processing Unit (GPU) skinning at startup. |
-executeMethod <ClassName.MethodName> または -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 for 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 the Unity project root) to export from the Unity project, and exportFileName is the package name. This option only exports whole folders at a time. You normally need to use this command with the -projectPath argument. |
-importPackage <pathname> |
Import the given asset package. Unity doesn’t display any import dialog. |
-job-worker-count <N> |
Specify the maximum thread count for the Unity JobQueue Job Worker Count. You can also set this value 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, use -logfile - <pathname> to direct the output to stdout , which by default is not the console. |
-noUpm |
Unity Package Manager を無効にします。 |
-openfile <path> |
Open the project from a path to a scene or package file. Alternatively, you can use the -projectPath argument |
-password <password> |
Unity エディターのアクティベーションのときに、ログインフォームにパスワードを入力します。 |
-projectPath <pathname> |
指定したパスのプロジェクトを開きます。パス名にスペースが含まれている場合は、引用符で囲みます。 |
-quit |
コマンドの実行が終了した後に Unity エディターを終了します。これによりエラーメッセージが表示されなくなる場合があります (ただし、エラーメッセージは Editor.log ファイルには保存されます)。 |
-releaseCodeOptimization |
リリースコード最適化モードを有効にし、セッションの現在のデフォルトコード最適化モードをオーバーライドします。 |
-setDefaultPlatformTextureFormat (Android のみ) |
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. |
-username <username> |
Unity エディターのアクティベーションのときに、ログインフォームにユーザー名を入力します。 |
-vcsMode <mode> |
Set the version control mode. Available modes are "Visible Meta Files" , "Hidden Meta Files" , Perforce , and PlasticSCM . You can use additional flags 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 (“).|
|-vcsModeSession <mode> |Set the version control mode for this session. Available modes are "Visible Meta Files" , "Hidden Meta Files" , Perforce , and PlasticSCM . You can use additional flags 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 (”). |
-version |
エディターを起動せずに、コマンドラインで Unity エディターのバージョン番号を表示します。 |
Use the following arguments to configure Unity’s batch mode. Batch mode enables Unity to run predefined tasks without additional input, which makes batch mode useful for automated tasks like testing. For more information, see Batch mode and built-in coroutine compatibility.
オプション | 詳細 |
---|---|
-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 doesn’t run if you omit this command line argument when you launch Unity in batch mode. This might lead to compiler errors. |
-batchmode |
Run Unity in batch mode. In batch mode, Unity runs command line arguments without the need for human interaction. It also suppresses pop-up windows that require human interaction (such as the Save Scene window); however, the Unity Editor itself opens as usual. You should always run Unity in batch mode when using command line arguments, because it allows automation to run without interruption. 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. 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 can’t 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. |
‑ignorecompilererrors |
When you use this argument, Unity continues to start your application even if there are compilation errors. |
-nographics |
When you run this in batch mode, Unity doesn’t 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, because Enlighten requires GPU acceleration. |
Use the following arguments to build players for various platforms from the command line. For more information about building players with command line arguments, see Unity Standalone Player command line arguments.
オプション | 詳細 |
---|---|
-buildLinux64Player <pathname> |
64-bit スタンドアロン Linux player をビルドします (例えば、-buildLinux64Player path/to/your/build )。 |
-buildOSXUniversalPlayer <pathname> |
64-bit スタンドアロン Mac OS X player をビルドします (例えば、-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 • WindowsStoreApps • tvOS |
-buildWindowsPlayer <pathname> |
Build a 32-bit standalone Windows player (for example, -buildWindowsPlayer path/to/your/build.exe). |
-buildWindows64Player <pathname> |
Build a 64-bit standalone Windows player (for example, -buildWindows64Player path/to/your/build.exe). |
Use the following arguments to configure Unity’s use of the cache server. For more information, see Cache Server.
オプション | 詳細 |
---|---|
-EnableCacheServer |
より新しい Accelerator Cache Server を使用するように Unity に指示します。また、-cacheServerEndpoint でアドレスを指定する必要があります。 |
-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> |
古い (v1) Cache Server の使用を有効にし、起動時に接続する IP アドレスを指定します。 これにより、エディター設定に保存されている設定がオーバーライドされます。 これを使用すると、Unity の複数のインスタンスを異なる v1 Cache Server に接続できます。 |
オプション | 詳細 |
---|---|
-disableManagedDebugger |
デバッガーのリッスンソケットを無効にします。 |
-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. |
-debugCodeOptimization |
デバッグコード最適化モードを有効にし、セッションの現在のデフォルトコード最適化モードをオーバーライドします。 |
-enableCodeCoverage |
Enables code coverage and allows access to the Coverage API. |
-force-d3d12-debug |
Enables the DX12 validation layer. This is useful for working on XR plugins or native plugins. |
-force-d3d12-debug-gbv |
Enables the DX12 GPU-based validation. This is useful for working on XR plugins or native plugins. |
-force-vulkan-layers |
Enables the Vulkan validation layer. This is useful for working on XR plugins or native plugins. |
-stackTraceLogType |
Allow detailed debugging. All settings allow None, Script Only and Full to be selected (for example, -stackTraceLogType Full ). |
Use the following arguments to force the Unity Editor to use a specific graphics API.
オプション | 詳細 |
---|---|
-force-d3d11 (Windows のみ) |
レンダリングで Direct3D 11 を使用します。通常、グラフィックス API は Player 設定 での値に依存します (デフォルトは D3D11 です)。 |
-force-d3d12 (Windows のみ) |
レンダリングで Direct3D 12 を使用します。通常、グラフィックス API は Player 設定 での値に依存します。 |
-force-glcore |
Make the Editor use OpenGL 3/4 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, the editor uses Direct3D. |
-force-glcoreXY |
Similar to-force-glcore , but requests a specific OpenGL context version. Accepted values for XY: 32, 33, 40, 41, 42, 43, 44 or 45. |
-force-gles (Windowsのみ) |
レンダリングで端末の OpenGL を使用します。エディターは、ベストな OpenGL ES バージョンと、OpenGL ドライバから利用可能なすべての OpenGL ES 拡張の利用を試みます。 |
-force-glesXY (Windowsのみ) |
-force-gles と同じですが、OpenGL ES のコンテキストバージョンをリクエストすることができます。XYに指定できる値は、「30、31、32」です。 |
-force-vulkan |
レンダリングで Vulkan を使用します。通常、グラフィックス API は Player 設定 での値に依存します。 |
-force-clamped |
-force-glcoreXY と一緒に使用することにより、追加された OpenGL 拡張を Unity が確認することを避けることができます。これにより、同じコードパスで複数のプラットフォーム間で実行できます。 |
Use the following arguments to process a Unity license or run the Unity Editor with different license options.
オプション | 詳細 |
---|---|
-createManualActivationFile |
Step one of a three-step process to manually activate a Unity license. For more information, see Generate a license activation file (.alf) from the command line. |
-force-free |
Run the Editor as if there is a free Unity license on the machine, even if a Unity Pro license is installed. |
-manualLicenseFile <yourulffile> |
Step three of a three-step process to manually activate a Unity license. For more information, see Generate a license activation file (.alf) from the command line. |
-returnlicense |
Return the currently active license to the license server. For more information, see Returning your license. |
-serial <serial> |
Activate your Unity license with the specified serial number. For more information, see Activate a license from the command line. Note: When you use this argument, you must also use the -batchmode argument. It’s also good practice to specify the -quit argument. |
Use the following arguments to configure Unity’s use of the Metal graphics API for Apple devices.
オプション | 詳細 |
---|---|
-force-device-index |
Metal を使用する場合に、GPU のインデックスを渡すことによって、エディターに特定の GPU デバイスを使用させます(macOS のみ)。 |
-force-low-power-device (macOS のみ) |
Metal を使用する場合に、低消費電力のデバイスを使用させます。 |
-force-metal |
デフォルトのグラフィックス API として Metal を使用させます(macOS のみ)。 |
Use the following arguments to configure Unity’s use of the Profiler.
オプション | 詳細 |
---|---|
-deepprofiling |
CPU プロファイラー の Deep Profiling (詳細プロファイリング) オプションを有効にします。 |
-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> |
この引数は、プロファイルデータを .raw ファイルに送信するように Unity Profiler を設定します。プレイヤーとエディターの両方で使用できます。 |
-profiler-capture-frame-count <NumberOfFrames> |
この引数は、起動時に .raw ファイルに送信する場合に、プロファイラーがキャプチャするフレーム数を設定します。プレイヤーでのみ機能します。 |
-profiler-maxusedmemory |
デフォルトでは、 Unity Profiler の maxUsedMemory はプレイヤー用に 16MB、エディター用に 256MB です。この引数を使用して、起動時に maxUsedMemory パラメーターをカスタムサイズに設定できます (例えば、-profiler-maxusedmemory 16777216 )。サイズはバイト単位で設定します。 |
*C# script in the project:*
using UnityEditor;
class MyEditorScript
{
static void PerformBuild ()
{
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
buildPlayerOptions.scenes = new[] { "Assets/Scene1.unity", "Assets/Scene2.unity" };
BuildPipeline.BuildPlayer(buildPlayerOptions);
}
}
以下のコマンドは Unity をバッチモードで実行し、MyEditorScript.PerformBuild
メソッドを実行し、その後、完了時に終了します。
Windows
"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -projectPath "C:\Users\UserName\Documents\MyProject" -executeMethod
MyEditorScript.PerformBuild
macOS:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath ~/UnityProjects/MyProject -executeMethod
MyEditorScript.PerformBuild
これらの引数は、特殊な環境下または 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. |
これらのパッケージをインストールすると、追加のエディターコマンドライン引数が利用可能になります。
Package | 詳細 |
---|---|
Burst | See Burst package documentation. |
Test Framework | See Unity Test Framework package documentation. |
Code Coverage | See Code Coverage package documentation. |