Reading text file in Unreal Engine 4

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.

  1. Create class actor component

    Name it “TextReaderComponent”.

  2. Put this code in your header & implementation files.

  3. Compile!

    Compile in both Editor & Visual Studio.

  4. 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.