How can I put a textfile inside an exported game and read from it?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LyffLyff

First, I have been trying to make a game recently, where a big part of it is reading from different books. The text inside these books is saved inside .txt files, I read them from my user:// directory but, of course that stops working on an exported game, since I’d have to export it with these textfiles and read them somehow. Sadly when I put the textfiles inside the main game directory they cant be loaded anymore,.

Now comes my question, is there any way to ship an exported version of a game with these .txt files and be able to read from them as if they were a regular .txt file or would I have to put the text from them in code?

1 Like
:bust_in_silhouette: Reply From: AlexTheRegent

Store your text files in res:// folder (or any res:// subfolders) and add *.txt (or file extension you are using to store your text files) to export. Otherwise only default file types are exported (*.tscn, *.gd, etc).

1 Like