This is the method that a Netease master shared with me. Because I haven’t won his opinion of allowing his name to be disclosed, I won’t say his name for the time being. Please understand.
This method allows the game to generate the “savegames” folder in the project project when it is packaged using the “development” configuration, just like in the editor. Instead of occupying your C disk.
usage method:
Open \ engine \ source \ runtime \ core \ private \ misc.paths.cpp
Found:
FString FPaths::ProjectUserDir()
{
const FString& UserDirArg = CustomUserDirArgument();
if (!UserDirArg.IsEmpty())
{
return UserDirArg;
}
#If (1) / / →→→change 0 to 1 ←←←
return FPaths::ProjectDir();
#else
if (ShouldSaveToUserDir())
{
// if defined, this will override both saveddirsuffix and enginesaveddirsuffix
#ifdef UE_ SAVED_ DIR_ OVERRIDE
return FPaths::Combine(FPlatformProcess::UserSettingsDir(), TEXT(PREPROCESSOR_TO_STRING(UE_SAVED_DIR_OVERRIDE))) + TEXT(“/”);
#else
return FPaths::Combine(FPlatformProcess::UserSettingsDir(), FApp::GetProjectName()) + TEXT(“/”);
#endif
}
else
{
return FPaths::ProjectDir();
}
#endif
}
compile.
Finished, now you can use the “release” configuration to package your game without worrying about your C disk!
↑ English version of software translation
↓中文原版
这是一位网易的大佬分享给我的办法。因为我还没有争取到他的允许公开名字的意见,暂时不说他的名字,请理解。
这个办法可以让游戏在使用“开发”配置打包的时候,依然可以和在编辑器里一样在项目工程里生成“SaveGames”文件夹。而不是占用你的C盘。
使用方法:
打开\Engine\Source\Runtime\Core\Private\Misc.Paths.cpp
找到:
FString FPaths::ProjectUserDir()
{
const FString& UserDirArg = CustomUserDirArgument();
if (!UserDirArg.IsEmpty())
{
return UserDirArg;
}
#if 1 //→→→在这里把0改成1←←←
return FPaths::ProjectDir();
#else
if (ShouldSaveToUserDir())
{
// if defined, this will override both saveddirsuffix and enginesaveddirsuffix
#ifdef UE_SAVED_DIR_OVERRIDE
return FPaths::Combine(FPlatformProcess::UserSettingsDir(), TEXT(PREPROCESSOR_TO_STRING(UE_SAVED_DIR_OVERRIDE))) + TEXT(“/”);
#else
return FPaths::Combine(FPlatformProcess::UserSettingsDir(), FApp::GetProjectName()) + TEXT(“/”);
#endif
}
else
{
return FPaths::ProjectDir();
}
#endif
}
编译。
完成,现在你可以使用“发行”配置打包你的游戏,不用担心你的C盘了!