简述
- 自动化工具(Unreal Automation Tool,简称 UAT)
- 自动化工具使用特定的命令 BuildCookRun
- 封装流程包含
- 构建(Build):该阶段将为所选择的平台编译可执行文件。
- 烘培(Cook):该阶段通过在特殊模式下执行编辑器来转化内容。
- 暂存(Stage):该阶段将可执行文件和内容复制到暂存区,它是开发目录以外的独立目录。
- 打包(Package): 该阶段将项目打包成平台原生的分发格式。
- 部署(Deploy):该阶段将构建版本部署到目标设备。
- 运行(Run):该阶段在目标平台上启动已封装的项目。
- 封装流程包含
- 可以使用 RunUAT.bat 进行打包,路径为
Engine/Build/BatchFiles/RunUAT.bat
- shipping 打包后的savegame路径为
C:\Users\[UserName]\AppData\Local\[ProjectName]\Saved\SaveGames
编辑器打包
- File -> Package Project ->目标平台
- 编译配置
- DebugGame
- Development
- Shipping
- 默认生成路径
[ProjectName]\WindowsNoEditor
,可自定义路径
- 更多设置 ProjectSettings -> Package
- 日志 Running AutomationTool 部分
Running AutomationTool UATHelper: Packaging (Windows (64-bit)): Parsing command line: -ScriptsForProject="C:/Users/Alice/Documents/Unreal Projects/tips/tips.uproject" BuildCookRun -nocompileeditor -installed -nop4 -project="C:/Users/Alice/Documents/Unreal Projects/tips/tips.uproject" -cook -stage -archive -archivedirectory="C:/Users/Alice/Documents/Unreal Projects/tips" -package -ue4exe=C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe -compressed -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -target=tips -clientconfig=Development -utf8output
在设备上启动 Launch
- PIE 工具栏 Launch
- 默认生成路径
[ProjectName]\Saved\StagedBuilds\WindowsNoEditor
- 默认执行
C:\Users\Alice\Documents\Unreal Projects\tips\Saved\StagedBuilds\WindowsNoEditor\tips\Binaries\Win64\tips.exe ../../../tips/tips.uproject /Game/CPPFunction/Pak/PakMap -stdout -abslog="C:\Users\Alice\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+SoftwareInstallation+EpicGames+UE_4.26\Client.log" -Messaging -Windowed -CrashForUAT -SessionId=E68DB8EB44C5712DE6D61BBE209F527E -SessionOwner="Alice" -SessionName="Launch On Device"
- 默认生成路径
- 可在 Project Launcher 自定义
- 可使用UnrealFrontend
[EnegineDir]\Engine\Binaries\Win64\UnrealFrontend.exe
- UnrealFrontend 可以执行高级编译、烘焙、部署、打包及启动选项
Project Launcher 打包
- 图示
- 执行步骤
- Running AutomationTool
Parsing command line: -ScriptsForProject="C:/Users/Alice/Documents/Unreal Projects/tips/tips.uproject" BuildCookRun -project="C:/Users/Alice/Documents/Unreal Projects/tips/tips.uproject" -noP4 -clientconfig=Development -serverconfig=Development -nocompile -nocompileeditor -installed -ue4exe=C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe -utf8output -platform=Win64 -targetplatform=Win64 -build -cook -map= -unversionedcookedcontent -pak -createreleaseversion=1.0.0 -compressed -prereqs -stage -package -cmdline=" -Messaging" -addcmdline="-SessionId=9876DEE24FEBCC47A5E8C29B1BDD9E48 -SessionOwner='Alice' -SessionName='tip' " -archive -archivedirectory="C:/Users/Alice/Documents/Unreal Projects/tips/"
- BUILD COMMAND STARTED
Running: C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\DotNET\UnrealBuildTool.exe tips Win64 Development -Project="C:\Users\Alice\Documents\Unreal Projects\tips\tips.uproject" "C:\Users\Alice\Documents\Unreal Projects\tips\tips.uproject" -NoUBTMakefiles -remoteini="C:\Users\Alice\Documents\Unreal Projects\tips" -skipdeploy -Manifest="C:\Users\Alice\Documents\Unreal Projects\tips\Intermediate\Build\Manifest.xml" -NoHotReload -log="C:\Users\Alice\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+SoftwareInstallation+EpicGames+UE_4.26\UBT-tips-Win64-Development.txt"
- COOK COMMAND STARTED
Running: C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe "C:\Users\Alice\Documents\Unreal Projects\tips\tips.uproject" -run=Cook -TargetPlatform=WindowsNoEditor -fileopenlog -unversioned -createreleaseversion=1.0.0 -abslog=C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Programs\AutomationTool\Saved\Cook-2021.05.24-16.21.35.txt -stdout -CrashForUAT -unattended -NoLogTimes -UTF8Output
- STAGE COMMAND STARTED
- PACKAGE COMMAND STARTED
RunUAT.bat 脚本打包
- 通过上面打包日志输出 Running AutomationTool 部分,可以将替换 RunUAT.bat 执行脚本
- 当项目过大时,或者服务器定期执行打包,可以使用 RunUAT.bat 进行打包
- 脚本模板
[EngineDir]\Engine\Build\BatchFiles\RunUAT.bat -ScriptsForProject="[ProjectDir]/ProjectName.uproject" BuildCookRun -nocompileeditor -installed -nop4 -project="[ProjectDir]/ProjectName.uproject" -cook -stage -archive -archivedirectory="[PackageDir]" -package -ue4exe=[EngineDir]\Engine\Binaries\Win64\UE4Editor-Cmd.exe -compressed -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -target=tips -clientconfig=Development -utf8output
- 分行便于阅读脚本模板
[EngineDir]\Engine\Build\BatchFiles\RunUAT.bat -ScriptsForProject="[ProjectDir]/ProjectName.uproject" BuildCookRun -nocompileeditor -installed -nop4 -project="[ProjectDir]/ProjectName.uproject" -cook -stage -archive -archivedirectory="[PackageDir]" -package -ue4exe=[EngineDir]\Engine\Binaries\Win64\UE4Editor-Cmd.exe -compressed -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -target=tips -clientconfig=Development -utf8output
- 实践
C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Build\BatchFiles\RunUAT.bat -ScriptsForProject="C:/Users/Alice/Documents/Unreal Projects/tips/tips.uproject" BuildCookRun -nocompileeditor -installed -nop4 -project="C:/Users/Alice/Documents/Unreal Projects/tips/tips.uproject" -cook -stage -archive -archivedirectory="C:/Users/Alice/Documents/Unreal Projects/tips" -package -ue4exe=C:\SoftwareInstallation\EpicGames\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe -compressed -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -target=tips -clientconfig=Development -utf8output