【UE4 C++】资源烘焙与UE4Editor.exe启动

资源烘焙

  • 虚幻引擎以内部使用的特定格式存储内容资源,将内容从内部格式转换为特定于平台的格式的过程 称为 烘焙((Cooking)

从编辑器烘焙资源

  • FIle → Cook Content for Windows

从命令行烘焙资源

  • 默认保存 %ProjectDir%/Saved/Cooked/[TargetPlatform]/
  • 包含引擎资源、项目资源、插件资源
  • 烘焙出的文件类型为 .uasset,.umap,.uexp,.ubulk
    • .uexp 包含该资源对应的UE4版本号、头部大小、包路径等信息,数据对应PackageFileSummary类,
  • commandlet必须通过 run=cook 指定
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>]

// Example UE4Editor.exe
C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\Win64\UE4Editor.exe
 "C:\Users\Alice\Documents\Unreal Projects\DesignPatterns\DesignPatterns.uproject"
 -run=cook -targetplatform=WindowsNoEditor -Map=NewMap -Iterate -UnVersioned -Compressed

// Example UE4Editor-Cmd.exe
C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe
 "C:\Users\Alice\Documents\Unreal Projects\DesignPatterns\DesignPatterns.uproject"
 -run=Cook  -TargetPlatform=WindowsNoEditor -unversioned  -stdout -CrashForUAT -unattended -NoLogTimes  -UTF8Output

选项说明

-targetplatform=<Plat1>+<Plat2>
指定要烘焙的平台。可用平台列表包含WindowsNoEditor、WindowsServer、LinuxServer、PS4, XboxOne、IOS和Android。

-iterate
指定烘焙器仅烘焙过时项目。如果不指定该选项,则沙箱目录将被删除,所有内容将重新烘焙。

-Map=<Map1>+<Map2>+...
指定要构建的贴图。

-cookonthefly
指定以服务器模式启动烘焙器。这样将启动服务器,服务器将等待游戏连接,然后根据需要提供烘焙的数据。使用该选项时,游戏需要在其命令行上指定-filehostip=<Server IP>以便能够连接服务器。

-MapIniSection=<ini file section>
指定ini文件中包含贴图名称的分段。烘焙器将烘焙指定分段中指定的所有贴图。

-UnVersioned
保存所有烘焙的数据包,不含版本。然后这些数据包在加载时会被假定为最新版本。

-CookAll
烘焙所有内容。

-Compressed
告知烘焙器压缩烘焙过的数据包。

UE4Editor.exe 启动

  • 启动引擎编辑器
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" -skipcompile
  • 启动项目编辑器
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe"  "%GameDir%\MyGame.uproject" -skipcompile
  • 单机启动游戏单机
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe"  "%GameDir%\MyGame.uproject" TestMap_Main -game -skipcompile
  • 启动本地ds
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe"  "%GameDir%\MyGame.uproject" TestMap_Main -game -server -log -skipcompile
  • 启动游戏并联网加入本地ds
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe"  "%GameDir%\MyGame.uproject" 127.0.0.1 -game -skipcompile

参考

posted @ 2021-05-22 21:26  砥才人  阅读(2183)  评论(0编辑  收藏  举报