How do you get Godot's "Text File" resources to work properly

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

I’ve been writing a custom dialogue engine with Godot. The way it works is it reads a text file, and then loads the dialogue from it. Godot’s text files work fine when I create one from the editor, but the second I close it and come back, it forgets that the resource is a text file.

I end up getting this error:

scene/resources/resource_format_text.cpp:804 - res://Test.tres:1 - Parse Error: Expected ‘[’
Failed to load resource ‘res://Conversations/Test.tres’.
Failed loading resource: res://Conversations/Test.tres. Make sure resources have been imported by opening the project in the editor at least once.

I’ve looked at the files of other types, and it looks like it has a text format such as:

[gd_resource type=“[Type goes here]” format=2]


I’ve tried adding this to some text files to see if it will do anything, but nothing happens.

One last thing. I know you can use .txt files and they work the same way, but it doesn’t seem like they are supported by Godot very well. They don’t show up in the file system dock, and they don’t have the text editor like Godot has support for with the built in text file type.

I don’t know if all of this is a bug, but it definitely feels like I’m missing something.

Thank you in advance for your time!

:bust_in_silhouette: Reply From: rossunger

I might be totally wrong, but I think it might be a case of needing to escape special characters such as quotes ( " ) using a backlash " \ "