使用VS2022进行Unreal开发
安装HLSL工具和面向Unreal引擎的IDE支持
需要在“单个组件”中搜索HLSL工具和面向Unreal引擎的IDE支持

注1:Visual Studio Installer所在路径为C:\program files (x86)\microsoft visual studio\installer\vs_installer.exe
注2:进入Visual Studio,可通过Tools菜单 -- Get Tools and Features...来打开
注3:也可以从开始菜单安装程序中搜索Visual Studio Installer来打开
需要注意的是,如果在“工作负荷” -- 勾选“使用C++的游戏开发”,然后去掉其他选项仅选择HLSL工具、面向Unreal引擎的IDE支持,就会导致很多组件丢失

在编译c++项目时,会报如下错误:
The WindowsSDKDir property is not defined. Some build tools may not be found. The VCToolsInstallDir property is not defined. Some build tools may not be found.
在Generate Visual Studio project files会报如下错误:
WARNING: Visual Studio C++ 2022 installation not found - ignoring preferred project file format. WARNING: Visual Studio 2019 is installed, but is missing the C++ toolchain. Please verify that the "VC++ 2019 toolset" component is selected in the Visual Studio 2019 installation options. ERROR: Visual Studio 2019 must be installed in order to build this target.
从Visual Studio Marketplace安装HLSL工具

注:菜单Extensions -- Manage Extensions...
支持ush usf格式文件
Tools-》options-》Text Editor-》File Extension,添加usf、ush到列表中,然后打开ush、usf文件,此时发现就可以有语法提示了

同时需要在VA中关闭Enable support for shader files

Unreal Engine Log窗口

注1:打开菜单“View” -- “Other Windows” -- “Unreal Engine Log”
注2:不过只有在vs中调试游戏时,才会刷log到Unreal Engine Log窗口中
Output窗口Unreal Engine Integration Logging

注1:每次Unreal Engine Integration Logging中有消息输出时, Output都会切到这个Tab下,导致Build和Debug时非常难受
注2:解决方法可参考[UE5.1.1 + VS 2022] UE Integration Logging: Logs modules while not running the engine??
UE5项目安装额外组件
打开ue5项目,提示如下,点击Install拉起Visual Studio Installer,来安装使用C++的游戏开发和MSVC v143 - VS 2022 C++ x64/x86 生成工具(v14.36-17.6)
注:使用C++的游戏开发可以不安装

手动替换MSVC ToolChain Toolset版本
① 将版本14.38.33130放置到D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC目录中
并把原来版本14.39.33519重命名备份.14.39.33519,并拷贝到D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\进行备份

② 修改D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt文件中的内容为14.38.33130
注1:如果不修改Microsoft.VCToolsVersion.default.txt,ue不会报错,但是cmake则会报:could not find any instance of Visual Studio
注2:ue编译的log如下
1>Building MyGameEditor... 1>Using Visual Studio 2019 14.29.30152 toolchain (E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.18362.0 SDK (E:\Windows Kits\10).
升级VS2022版本
点击更新按钮,从17.6.4升级到17.14.7版本

注1:更新后MSVC ToolChain Toolset版本也会升级14.44.35207
注2:更新后Windows SDK也会安装10.0.22621.0和10.0.26100.0版本

如果需要将MSVC ToolChain Toolset和Windows SDK Version改回去,可以在UnrealEngine\Engine\Saved\UnrealBuildTool\BuildConfiguration.xml配置指定的版本号
<?xml version="1.0" encoding="utf-8" ?> <Configuration xmlns="https://www.unrealengine.com/BuildConfiguration"> <BuildConfiguration> <bEditorDependsOnShaderCompileWorker>false</bEditorDependsOnShaderCompileWorker> </BuildConfiguration> <WindowsPlatform> <CompilerVersion>14.38.33130</CompilerVersion> <WindowsSdkVersion>10.0.22000.0</WindowsSdkVersion> </WindowsPlatform> </Configuration>
更多详见:编译配置
也可以用installer把10.0.22621.0和10.0.26100.0两个版本卸载掉

UBT中判断Windows SDK Version是判断D:\Windows Kits\10\Include\10.0.22000.0\um\windows.h文件是否存在

设置换行回车符

检测consistent line ending(回车换行符)


检测UTF-8编码

块模式编辑
① 点击光标到起始位置

② 按住Alt+Shift,然后再点击光标到结束位置,即可选中两次光标的块内容

③ 按Delete即可删除块选中的内容

查看类的Memory Layout
将鼠标放在类名上,就会弹出tips,然后点击Memory Layout来查看 注:vs2022的版本为17.13.1

弹出类的Memory Layout结构图

点击class FGraphicsPipelineStateInitializer旁边的按钮,按表格方式来查看

开启Sticky Scroll

参考
Install Visual Studio Tools for Unreal Engine
浙公网安备 33010602011771号