首页 > 解决方案 > 无法在新的 git 克隆存储库上从命令行构建 Unity 项目

问题描述

我希望在 git 克隆它们之后构建 Unity 项目。但是,当它们是“新鲜的”(仅不是 giignored 文件)时,构建非常短并且没有输出。我必须使用 Unity Editor 打开项目以使构建命令行正常工作。

构建命令行:

 D:/------/Unity.exe -quit -batchmode -logFile uniytBuildLog.txt -buildTarget Win64 -executeMethod AutoBuilder.PerformBuild -appName test.exe -buildFolder "./Build/"

尽管出现了奇怪的错误,但似乎成功的构建日志结束

Reloading assemblies after script compilation.
Begin MonoManager ReloadAssembly
Refreshing native plugins compatible for Editor in 3.09 ms, found 7 plugins.
Preloading 2 native plugins for Editor in 0.15 ms.
Mono: successfully reloaded assembly
Refreshing native plugins compatible for Editor in 0.79 ms, found 7 plugins.
Preloading 2 native plugins for Editor in 0.11 ms.

----- Total AssetImport time: 0.130863s, AssetImport time: 0.000000s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]

- Completed reload, in  1.564 seconds
Initializing Unity.PackageManager (PackageManager) v2017.2.1 for Unity v2017.2.1f1
Registering platform support modules:
Registered platform support modules in: 0.0496396s.
Native extension for OSXStandalone target not found
Native extension for WindowsStandalone target not found
Native extension for LinuxStandalone target not found
Native extension for WebGL target not found
Native extension for Metro target not found
Native extension for iOS target not found
Native extension for Android target not found
Batchmode quit successfully invoked - shutting down!
Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.046037 seconds (Nothing changed)
Updating ProjectSettings/ProjectSettings.asset - GUID: 00000000000000004000000000000000...
 done. [Time: 61.503121 ms] 
Refreshing native plugins compatible for Editor in 1.32 ms, found 7 plugins.
Preloading 2 native plugins for Editor in 0.12 ms.

----- Total AssetImport time: 0.196505s, AssetImport time: 0.107053s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s]

Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.032108 seconds (Nothing changed)
[Package Manager] Server::Kill -- Server was shutdown
Cleanup mono
[usbmuxd] Stop listen thread
[usbmuxd] Listen thread exiting
Exiting batchmode successfully now!

Unhandled Exception: System.IO.DirectoryNotFoundException: Directory 'C:\Users\Ben\AppData\Local\Temp\160279e2' not found.

  at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x000f7] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Directory.cs:514 

  at System.IO.Directory.GetDirectories (System.String path, System.String searchPattern) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Directory.cs:275 

  at System.IO.Directory.GetDirectories (System.String path) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Directory.cs:270 

  at System.IO.Directory.RecursiveDelete (System.String path) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Directory.cs:186 

  at System.IO.Directory.Delete (System.String path, Boolean recursive) [0x0000c] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/Directory.cs:205 

  at System.CodeDom.Compiler.TempFileCollection.Delete () [0x00000] in <filename unknown>:0 

  at System.CodeDom.Compiler.TempFileCollection.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0 

  at System.CodeDom.Compiler.TempFileCollection.Finalize () [0x00000] in <filename unknown>:0 
debugger-agent: Unable to listen on 3896

标签: unity3d

解决方案


问题之一是由于缺乏与项目路径的论据。

我在想跳过这个参数会使用当前目录中的项目,但它会使用最后打开的项目,所以在我用编辑器打开它之前它不会构建正确的项目。


推荐阅读