这是我用于以编程方式进行构建的脚本
BuildPlayerOptions szBuildResult = new BuildPlayerOptions();
szBuildResult.scenes = scenes;
szBuildResult.locationPathName = m_szapkFileName;
szBuildResult.target = BuildTarget.StandaloneWindows;
szBuildResult.options = BuildOptions.None;
BuildPipeline.BuildPlayer(szBuildResult);
现在我试图做这样的事情
string result = BuildPipeline.BuildPlayer(szBuildResult);
但是它给我返回了一个错误提示
无法将类型UnityEditor.Build.Reporting.BuildReport转换为字符串
如何检查构建是否成功?
我正在使用Unity 2018.2
答案 0 :(得分:2)
BuildPipeline.BuildPlayer将返回BuildReport
对象。因此请使用BuildReport
而不是string
BuildReport result = BuildPipeline.BuildPlayer(szBuildResult);