Unity命令行处理重复登录等问题

启动Unity
在macOS上,在终端中键入以下内容以启动Unity:

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

在Windows上,在命令提示符中键入以下内容以启动Unity:

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

Unity命令行处理重复登录等问题_第1张图片

所有命令行表格:https://docs.unity3d.com/Manual/CommandLineArguments.html
Unity命令行处理重复登录等问题_第2张图片

例子
项目中的C#脚本:

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

以下命令以批处理模式执行Unity,执行该MyEditorScript.PerformBuild方法,然后在完成时退出。
视窗:

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

苹果系统:

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

你可能感兴趣的:(unity)