ue4 ini读写
2023-04-26 14:50 kk20161206 阅读(44) 评论(0) 编辑 收藏 举报以Game.ini为例
其他配置的读写看这里 CoreGlobals.h,替换下面的 GGameIni 参数即可,这些字符串保存的是对应配置文件的路径
extern CORE_API FString GEditorIni;
extern CORE_API FString GEditorPerProjectIni;
extern CORE_API FString GCompatIni;
extern CORE_API FString GLightmassIni;
extern CORE_API FString GScalabilityIni;
extern CORE_API FString GHardwareIni;
extern CORE_API FString GInputIni;
extern CORE_API FString GGameIni;
extern CORE_API FString GGameUserSettingsIni;
写入:
void AMyActor::WriteIniFile()
{
if (!GConfig) return;
//String
GConfig->SetString(
*VictorySection,
TEXT("Str"),
TEXT("HelloWorld"),
GGameIni
);
//FColor
GConfig->SetColor(
*VictorySection,
TEXT("Red"),
FColor(255, 0, 0, 255),
GGameIni
);
//FVector
GConfig->SetVector(
*VictorySection,
TEXT("Location"),
FVector(0, 0, 0),
GGameIni
);
//FRotator
GConfig->SetRotator(
*VictorySection,
TEXT("Rotation"),
FRotator(90, 0, 0),
GGameIni
);
GConfig->Flush(false, GGameIni);
const FString WriteSection = "MyCustomSection";
//String
GConfig->SetString(
*WriteSection,
TEXT("key1"),
TEXT("Hello world"),
GGameIni
);
GConfig->Flush(false, GGameIni);
————————————————
版权声明:本文为CSDN博主「蝶泳奈何桥.」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yangxuan0261/article/details/58595609