继续上一篇,因为通常为了拼Cave我们需要不停的修改FOV,分辨率,窗口位置这几个数据,所以最好把他们放置在外部文件中,动态读取。
1、UE4动态读取外部文件
新建一个C++类继承Blueprint Function Library,cpp文件代码如下:
```cpp
#include "ReadCSV.h"
//CSV解析器
#include "Runtime/Core/Public/Serialization/Csv/CsvParser.h"
//文件路径检索助手
#include "Runtime/Core/Public/Misc/Paths.h"
TArray<FString> UReadCSV::GetCSVDataToString(FString csvPath)
{
//文件路径+文件名
FString csvFile = FPaths::ProjectContentDir() + csvPath;
//返回值
TArray<FString> csvContent;
//判断路径下的文件是否存在
if (FPaths::FileExists(csvFile))
{
FString FileContent;
//把csv文件内容读取到字符串中
FFileHelper::LoadFileToString(FileContent, *csvFile);
//把字符串进行解析
FCsvParser* csvfiles = new FCsvParser(FileContent);
//解析器GetRows()方法会返回所有的单元格里的C风格的字符串
/*
*( [T