Something that really bug me is inability of ue4 to handle or read simple text file. Yes, you still can do this. But, what if I want to do is just put simple file text and read that as a string. You can do that in C++ using
For the purpose of this tutorial, we will create text file reader as a actor component. We need a method to read file that will be called from blueprint.
Create class actor component

Name it “TextReaderComponent”.
Put this code in your header & implementation files.
UFUNCTION(BlueprintCallable) FString ReadFile(FString filename);
FString UTextReaderComponent::ReadFile(FString filename)
{
//Read file ini [project]/Content/Data/
//you can change with other location
FString directory = FPaths::Combine(FPaths::GameContentDir(), "Data");
FString result;
IPlatformFile& file = FPlatformFileManager::Get().GetPlatformFile();
if (file.CreateDirectory(*directory)) {
FString myFile = directory + "/" + filename;
FFileHelper::LoadFileToString(result, *myFile);
}
return result;
}
Compile!
Compile in both Editor & Visual Studio.
Testing.
Create text file in Content/Data/file.txt. Fill it with whatever text you want. Add Component “Text Reader” in your actor. Drag component to Event Graph. Now you can read simple text file.

Does this read the entire text file into RAM?
I want to read large text files, and walk over them line by line. I can probably split on the newline character into a string array.
v.s. shows that:
UTextReaderComponent
,FPlatformFileManager
,FFileHelper
,FPaths
; are undefined, what is needed to include in the TextReaderComponent.cpp ?
FString directory = FPaths::Combine(FPaths::GameContentDir(), “Data”);
Should be
FString directory = FPaths::Combine(FPaths::GameContentDir(), TEXT(“Data”));
https://docs.unrealengine.com/en-US/API/Runtime/Core/GenericPlatform/IPlatformFile/index.html
https://docs.unrealengine.com/en-US/API/Runtime/Core/HAL/FPlatformFileManager/index.html
I don’t understand the last step. What type should this component be? How am I supposed to make this work? I can’t use an Actor, which I am sure of.
Never mind, I used static.