自学内容网 自学内容网

UE4中 -skipbuild -nocompile 有什么区别

在项目开发中,我看到了在调用 Engine\\Build\\BatchFiles\\RunUAT.bat 相关的命令行中,有 -skipbuild、 -nocompile 两个很像的参数,于是想探究一下它们的区别与含义。

-skipbuild 参数

到底有没有 -skipbuild 这个参数?根据 https://blog.csdn.net/u010385624/article/details/89916184 的介绍,有skip这个参数,但没有搜索到 -skipbuild 这个参数。我们可以在 AutomationTool.ProjectParams 看到所有的命令行传参,其中只有

CommandUtils.LogLog("Build={0}", Build);

CommandUtils.LogLog("SkipBuildClient={0}", SkipBuildClient);

CommandUtils.LogLog("SkipBuildEditor={0}", SkipBuildEditor);

但是,在这里发现了有skipbuild开关。

this.Build = GetParamValueIfNotSpecified(Command, Build, this.Build, "build");
bool bSkipBuild = GetParamValueIfNotSpecified(Command, null, false, "skipbuild");
if (bSkipBuild)
{
this.Build = false;
}

验证方式:如果同时传 -skipbuild 和 -build ,就会发现后文中的 Project.Build 无法进入到Build方法中。

-build 开关的含义

AutomationTool.ProjectParams.Build

作用1:AutomationTool.ProjectParams.AutodetectSettings

else if (!this.Build) // 如果不选build,那么就自动重置Target
{
    var ShortName = ProjectUtils.GetShortProjectName(RawProjectPath);
    GameTarget = Client ? (ShortName + "Client") : ShortName;
    EditorTarget = ShortName + "Editor";
    ServerTarget = ShortName + "Server";
}

作用2:一个限制验证(AutomationTool.ProjectParams.Validate),具体含义暂不解释。

if (Build && !HasCookedTargets && !HasEditorTargets && !HasProgramTargets)
{
    throw new AutomationException("-build is specified but there are no targets to build.");
}

作用3:决定了是否运行 Project.Build。对应的日志是:

********** BUILD COMMAND STARTED **********

调试时的注意事项

根据我之前写的博文(UE4如何调试BuildCookRun_ue 的 automationtool如何debug-CSDN博客), UAT的调试对应的是:

要注意,只有BuildCookRun命令才有ProjectParams的解析,而UBT的调试中,不会涉及ProjectParams 的解析,因此调试时不要断点到那里去了。

未完待续


原文地址:https://blog.csdn.net/sinat_23135151/article/details/142549510

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!