引擎相关内容记录
记录引擎相关内容的记录文档,大多是一些散乱的内容,可能是发布引擎相关、引擎功能开关、版本更新后不一致的地方等。
发布引擎时的相关修正
How To build the Unreal Editor (GitHub)
Setup.bat 缓存与速度太慢问题
个人使用 / 内网初次部署依赖:
推荐直接在 C:\Windows\System32\drivers\etc\hosts 文件新增一行 13.226.17.97 cdn.unrealengine.com
同时执行命令时使用 .\Setup.bat --threads=16 来多线程执行。
也可以添加一些额外的 exclude 项,例如不需要的特殊平台依赖等。
内网环境缓存:
对于内网环境,推荐使用:Setup.bat --cache=D:\UECache 将依赖缓存到本地目录,然后分发时修正 Setup.bat 脚本使用共享或网络路径等。
例如,from GPT:
@echo off
setlocal
pushd "%~dp0"
:: Default configurations
set TARGET_HOST=192.168.114.154
set UE_VERSION=UE5.5
set EXCLUDE_PLATFORM_PARAM=--exclude=Linux,Android,HoloLens,SteamDeck,Lumin,IOS,TVOS,Mac
set DEFAULT_CACHE_PATH="\\%TARGET_HOST%\ue5_setup_cache\%UE_VERSION%"
set DEFAULT_ARGS=%EXCLUDE_PLATFORM_PARAM% --force --cache=%DEFAULT_CACHE_PATH%
:: Merge default arguments with user-provided arguments
if not defined OVERRIDE_ARGS (
set MERGED_ARGS=%DEFAULT_ARGS% %*
) else (
set MERGED_ARGS=%OVERRIDE_ARGS%
)
:: Figure out if we should append the -prompt argument
set PROMPT_ARGUMENT=
for %%P in (%MERGED_ARGS%) do if /I "%%P" == "--prompt" goto no_prompt_argument
for %%P in (%MERGED_ARGS%) do if /I "%%P" == "--force" goto no_prompt_argument
set PROMPT_ARGUMENT=--prompt
:no_prompt_argument
:: Sync the dependencies
.\Engine\Binaries\DotNET\GitDependencies\win-x64\GitDependencies.exe %PROMPT_ARGUMENT% %MERGED_ARGS%
if %ERRORLEVEL% NEQ 0 goto error
:: Setup the git hooks
if not exist .git\hooks goto no_git_hooks_directory
echo Registering git hooks...
echo #!/bin/sh >.git\hooks\post-checkout
echo Engine/Binaries/DotNET/GitDependencies/win-x64/GitDependencies.exe %MERGED_ARGS% >>.git\hooks\post-checkout
echo #!/bin/sh >.git\hooks\post-merge
echo Engine/Binaries/DotNET/GitDependencies/win-x64/GitDependencies.exe %MERGED_ARGS% >>.git\hooks\post-merge
:no_git_hooks_directory
:: Install prerequisites
echo Installing prerequisites...
start /wait Engine\Extras\Redist\en-us\UEPrereqSetup_x64.exe /quiet /norestart
:: Register the engine installation
if not exist .\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe goto :no_unreal_version_selector
.\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe /register
:no_unreal_version_selector
:: Done!
goto :end
:: Error happened. Wait for a keypress before quitting.
:error
pause
:end
popd
添加 Bridge 与 Fab
官方文档中特意提到了这一点,可能会不存在 Bridge(Fab 也是一样的,应该太新了文档还没更)
The build process may not include some plugins - this could include some Epic maintained plugins such as Bridge ( Quixel's plugin for Quixel Megascans ) as well as other Epic and 3rd Party plugins. To be able to rebuild plugins with custom version of the engine, each plugin needs to have its own source code - usually kept in the "Source" folder of the plugin.
Follow the instructions on Building Plugins to rebuild your plugins for the custom build of the Engine you are using.
If for some reason the Bridge plugin does not compile with the Engine, you can grab the Bridge source files from the original source code in UnrealEngine\Engine\Plugins and add them to the Installed Build Bridge plugin. Then you can recompile them in a dedicated C++ project like any other plugin.
这里提到了可以手动添加插件,自发布引擎其实完全没有必要,在另一篇文档中官方提到了使用 InstalledEngineFilters.xml 可以排除一些文件,或额外添加一些文件。
RuntimeDependencies(针对每个模块,在
build.cs
文件中设置)自动对照并确定要在安装构建版本中包括哪些文件。但是,无法通过这种方式包括某些必需文件,因此需要在[UERoot]/Engine/Build/InstalledEngineFilters.xml
中定义它们。InstalledEngineFilters
XML 文件也会列出应从该构建版本中排除的文件模式,确定需要剥离或签名的文件类型以及要为哪些项目构建DDC。如果需要在安装构建版本中包括额外文件,可以首先考虑InstalledEngineFilters
XML 文件。
Bridge 和 Fab 就是在 CopyEditorExceptions 部分默认被注释掉了:
<Property Name="CopyEditorExceptions">
...
<!-- SANTA_CHANGE_BEGIN Internal release using fab and bridge plugins, annotated the following two lines. -->
<!-- Engine/Plugins/Fab/... -->
<!-- Engine/Plugins/Bridge/... -->
<!-- SANTA_CHANGE_END -->
...
</Property>
删除两个插件的注释后,再将插件的拷贝部分添加 ThirdParty 目录(笔者这里单独只针对两个插件添加的),即可正常运行:
<Property Name="CopyEditorEngineOrPlatformFilter" Value="">
...
<!-- Plugins -->
Plugins/....uplugin
Plugins/.../Content/...
Plugins/.../Config/...
Plugins/.../Resources/...
Plugins/.../Shaders/...
Plugins/.../Source/...
Plugins/.../Templates/...
<!-- SANTA_CHANGE_BEGIN Add fab and bridge third party folder -->
Plugins/Fab/ThirdParty/...
Plugins/Bridge/ThirdParty/...
<!--SANTA_CHANGE_END -->
这一区域里列出了所有需要拷贝的插件内容,可以看出是没有包含 ThirdParty 的,因此需要添加,如果没有添加,打开 Fab 时会提示:Failed to load URL file:///E:/Engine/Plugins/Fab/ThirdParty/index.html with error ERR FILE NOT FOUND (-6).
手动指定 BuildID
可以将您的编译ID强制设为特定值。您可以在
Build/Build.version
JSON文件中添加一个BuildId
条目(作为字符串变量)来实现,但不建议如此操作,因为它将移除阻止使用不兼容模块的检查。如果将强制编译ID与可在多个项目之间共享的插件一同使用,那么运行过期代码将十分容易。
指定日志时间戳时间
因为 UE 默认使用 UTC 时间,所以推荐修改配置:
\Engine\Config\BaseEngine.ini 或 Project\Config\DefaultEngine.ini 添加如下:
[LogFiles]
LogTimes=Local
如果在 Editor Preferences -> General -> OutputLog -> 将 Output Log Window Timestamp Mode 改成 Local Time
只会作用于该机器,因为该配置存储在 Project\Saved\Config\WindowsEditor\EditorPerProjectUserSettings.ini
更新问题记录
5.5 Stat 命令与 ScreenMessages
UE 更新 5.5 后,Stat 相关状态的显示与否受 ScreenMessages 控制:
bool bShowScreenMessages = !GIsHighResScreenshot && !GIsDumpingMovie && GAreScreenMessagesEnabled;
如果原始项目中默认 DisableAllScreenMessages,那 5.5 之后的包里需要手动执行下 EnableAllScreenMessages 才能正常显示 Stat 命令的相关状态。
(笔者体感上原来的状态挺好的,不清楚为何要改为受 ScreenMessages 的控制。)
Comments NOTHING