如何将 Unreal Visual Studio 解决方案文件生成到特定文件夹中

How to generate Unreal Visual Studio solution files into specific folders

我在 Windows 10 和 Unreal 4.15。

当我右击虚幻项目生成Visual Studio解决方案文件时,没有任何选项可以改变输出目录,它总是和项目文件在同一个文件夹,这意味着源文件和构建文件混合在一起。

对于构建文件由 CMake 生成的传统 C++ 项目,我们可以这样做:

mkdir build
cd build
cmake -A x64 ..
msbuild test.sln

构建文件和源文件是分开的。 Unreal项目有没有可能做这种好的实践?

下面是我目前用来为 Unreal 生成构建文件的命令行:

UnrealBuildTool.exe -projectfiles -project="%WORKSPACE%/projectname/projectname.uproject" -game -rocket -progress

它们并没有完全混合在一起。据我所知,Unreal Engine 个项目需要一个完全定义的文件夹结构 (Unreal Engine documentation)。

因此您的 C++ 源代码 位于文件夹 Source 中,但是 为 Visual Studio 或等效工具位于文件夹 Intermediate 中。因此,这些文件通常不由 Git 或其他版本控制工具进行版本控制。 (GitHub 有一个很好的预定义 .gitignore 文件用于 Unreal Engine GitHub Unreal Engine .gitignore)。

总而言之 - 不,这是不可能的 而且在我看来这也会适得其反 - 目前即使对于具有多个游戏模块的大型项目(它们实际上是DLL 文件 Gameplay Modules documentation).