Unreal Engine常用命令行

环境信息

LyraStarterGame官方版, 截至时间23.11.12
Unreal Engine 5.3.2 release版, 截至时间23.11.12
命令环境为PowerShell, 工作目录为LyraStarterGame/Build/BatchFiles/

工程目录结构

LyraStarterGame
->Build/BatchFiles //此处存放常用命令文件,bat,sh等
->Build/CollectedPSOs_PCD3D_SM6
->Build/CollectedPSOs_SF_Vulkan_SM6
 ->Build/Windows/PipelineCaches
->Config
->Content
->Platforms
->Plugins
->LyraStarterGame.uproject

生成Visual Studio工程

GenerateSln.bat


pushd %~dp0%
set CurDir=%cd%
popd

set EngineDir=E:\Code\UnrealEngine\Engine

set UBT=%EngineDir%/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe

set ProjectName=LyraStarterGame

%UBT%  -ProjectFiles %CurDir%/../../%ProjectName%.uproject  -Game -Engine
 

打包工程

PackageGame.bat


pushd %~dp0%
set CurDir=%cd%
popd

set EngineDir="E:\Code\UnrealEngine\Engine"

set RunUAT=%EngineDir%/Build/BatchFiles/RunUAT.bat

REM 此处可以切换Win64,Linux等目标平台
set TargetPlatform=Android

set ProjectName=LyraStarterGame

%RunUAT% BuildCookRun -Project=%CurDir%/../../%ProjectName%.uproject -TargetPlatform=%TargetPlatform% -CookFlavor=ASTC -ClientConfig=Development -build -cook -stage -package
 

转换PSO

ConvertPSO.bat


REM ShaderFormat可以切换SF_VULKAN_SM6等其他Shader格式,
REM 把生成的spc文件复制到Build/Windows/PipelineCaches或对应目标平台目录目录,再次构建即可

pushd %~dp0%
set CurDir=%cd%
popd


set ProjectName=LyraStarterGame

set EngineDir=E:\Code\UnrealEngine\Engine

set EditorExe=%EngineDir%/Binaries/Win64/UnrealEditor.exe

set ShaderFormat=PCD3D_SM6

set PSORecordDir=%CurDir%/../CollectedPSOs_%ShaderFormat%

set PSOStableCacheFile=%PSORecordDir%/231112_%ProjectName%_%ShaderFormat%.spc

set Param=-run=ShaderPipelineCacheTools expand %PSORecordDir%/*.rec.upipelinecache %PSORecordDir%/*.shk %PSOStableCacheFile%   -log

echo %EditorExe% "%Param%"

%EditorExe% %Param%

待续...

posted @ 2023-11-12 12:20  剑过不留痕残月分断魂  阅读(116)  评论(0编辑  收藏  举报