构建目标ios在批处理模式下运行Unity时无法使用

时间:2018-04-29 06:23:29

标签: unity3d jenkins build

我一直在尝试使用Jenkins从Unity自动化我们的iOS版本。问题是当我传入" -buildTarget ios"到Unity可执行文件,打印出Build目标平台' iOS'无法使用。没有任何额外的信息,所以我可以知道为什么!我可以使用Unity Editor成功构建。 我尝试了以下任何一组参数,但仍然遇到同样的错误。

-batchmode -nographics -projectPath "/Volumes/Data/UnityProject" -logFile 
"/Volumes/Data/UnityProject/Unity/Editor.log" -executeMethod 
PlayerBuilder.BuildSibApp -buildPath ${WORKSPACE} -quit -buildTarget ios

-batchmode -nographics -projectPath "/Volumes/Data/UnityProject" -logFile 
"/Volumes/Data/UnityProject/Unity/Editor.log" -executeMethod 
PlayerBuilder.BuildSibApp -buildPath ${WORKSPACE} -quit -buildTargetGroup ios -buildTarget ios

如果我省略-nographics,则会产生有关连接到窗口服务器并退出的错误。 如果我省略-buildTarget iOS,则会产生编译错误,说无法找到UnityEngine.iOS。 顺便说一句,我使用的是MacOS,Unity 5.6.3f1

来自Unity的日志:

COMMAND LINE ARGUMENTS:
/Applications/Unity/Unity.app/Contents/MacOS/Unity
-batchmode
-nographics
-projectPath
/Volumes/Data/Pesarkhande-Git
-logFile
/Volumes/Data/Pesarkhande-Git/Unity/Editor.log
-executeMethod
PlayerBuilder.BuildSibApp
-buildPath
/Users/Shared/Jenkins/Home/workspace/Pesarkhande-iOS-Sibapp
-buildTarget
iOS
-quit
Successfully changed project path to: /Volumes/Data/Pesarkhande-Git
/Volumes/Data/Pesarkhande-Git
Loading GUID <-> Path mappings...0.000034 seconds
Loading Asset Database...0.033660 seconds
Audio: FMOD Profiler initialized on port 54900
AssetDatabase consistency checks...0.123464 seconds
Build target platform 'iOS' could not be used.

执行的代码:

public static void BuildSibApp()
{

    var args = Environment.GetCommandLineArgs();

    var buildPath = GetCommandLineValue(args, "-buildPath");
    Debug.Log("Build Path: "+buildPath);

     var error = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes.Where(p => p.enabled).Select(p => p.path).ToArray(),
        buildPath,
        BuildTarget.iOS,
        BuildOptions.SymlinkLibraries | BuildOptions.Il2CPP);

    if(!string.IsNullOrEmpty(error))
    {
        Debug.LogError(error);
        throw new Exception("Build Failed: \n"+error);
    }
}

感谢任何帮助,谢谢

0 个答案:

没有答案