UE パッケージ化 (ProjectLauncher を使用しますが、カスタマイズされたパッケージング効果を実現するためにソース コードを変更しないでください)

解決策 1: UAT を使用し、
BUILD SUCCESSFUL の出力後にカスタマイズされた操作を実行するように Automation.cs コードを変更します。

App=D:\UEProject\UE5test\ue5test1\Packer.bat,CommandLine=D:\UEProject\UE5test\ue5test1

このコード行は、「ProjectLauncher」->「Build」->「Additional Command Line Parameters」に配置されます。

CommandUtils.LogInformation("BUILD SUCCESSFUL");
for (int Index = 0; Index < CommandInfo.Arguments.Count; ++Index)
{
    string app = "";
    string commandLine = "";

    string argument = CommandInfo.Arguments[Index];

    // 提取 App 的值
    if (argument.Contains("App="))
    {
       int startIndex = argument.IndexOf("App=") + 4;
       int endIndex = argument.IndexOf(",", startIndex);
       if (endIndex != -1 && endIndex > startIndex)
       {
          app = argument.Substring(startIndex, endIndex - startIndex);
       }
    }

    // 提取 CommandLine 的值 
    if (argument.Contains("CommandLine="))
    {
       int startIndex = argument.IndexOf("CommandLine=") + 12;
       int endIndex = argument.IndexOf(",", startIndex);
       if (endIndex != -1 && endIndex > startIndex)
       {
          commandLine = argument.Substring(startIndex, endIndex - startIndex);
       }
    }

    CommandUtils.LogInformation("Custom CommandLine: {0},{1}", app, commandLine);
    if (!string.IsNullOrEmpty(app))
    {
       CommandUtils.Run(app, commandLine);
    }
}

オプション 2: RunUAT.bat を変更する

rem ## Run AutomationTool
:DoRunUAT
pushd %UATDirectory%
dotnet %UATExecutable% %*
:: 调取自定义的程序
:: call "D:\UEProject\UE5test\ue5test1\Packer.bat"
setlocal EnableDelayedExpansion
set "args=%*"
for /F "tokens=2 delims== " %%a in ("!args!") do (
    set "filePath=%%~dpa"
    echo !filePath!Packer.bat
    call "!filePath!Packer.bat"
)
endlocal
popd
set RUNUAT_ERRORLEVEL=%ERRORLEVEL%

対応するバッチ ファイルまたは exe プログラムの内容はカスタマイズ可能

おすすめ

転載: blog.csdn.net/zx1091515459/article/details/132327855
おすすめ