编辑器菜单[Cook Content for Windows]可以烘焙所有关卡和资源
2、烘焙指定关卡
烘焙指定关卡可以用命令行实现,其中要加入-map参数,如-map=/Game/NewMap就会只烘焙NewMap关卡
官方文档提供的命令行格式如下:
UE4Editor.exe <GameName or uproject> -run=cook -targetplatform=<Plat1>+<Plat2> [-cookonthefly] [-iterate] [-map=<Map1>+<Map2>]
或
UE4Editor-Cmd.exe <GameName> -run=cook -targetplatform=<Plat1>+<Plat2> [-cookonthefly] [-iterate] [-map=<Map1>+<Map2>]
各参数含义
也可以简单仿照FMainFrameActionCallbacks::CookContent函数创建一个批处理任务,例如
void CookMap(const FString& InMap)
{
FString ProjectPath = FPaths::IsProjectFilePathSet() ? FPaths::ConvertRelativePathToFull(FPaths::GetProjectFilePath()) : FPaths::RootDir() / F