Okay, so basically, I’m trying to make a rhythm game right now, and I decided to use .sm files (the StepMania note chart file format) to hold note charts and the like, as there are lots of tools for editing them. The only issue is, whenever I import these files into my project, they don’t appear in the file system on the editor despite being in my computer’s files in the game, and more importantly, when I try to access those files using FileAccess.open(filename, FileAccess.READ), it doesn’t work. It just says it “can’t find the file,” so I can’t get any of the data I need to actually test to see if I can get the data from the file. I have found next to no info on how to import custom file types into godot. How can I fix this? Should I switch to a different file format? I would prefer not to because I’m too stubborn and this format is also easier for my team to use.
Only supported file formats will show up in the actual file system inside Godot. For example, if you add a .gif file, that won’t show up either. The best you can do is put them in the appdata folder, and dynamically load them during the runtime of your game and list them, since you CAN read the contents of a folder and their files. But you cannot directly add these files into the project as far as I know, unless you modify the source code of Godot directly.
Alternatively, you can add them as a .txt file, so they will show up.
I tried changing the file to a .txt file to see if that would fix it, but it’s still not reading it. I’m beginning to suspect this isn’t a problem with the .sm file at all, but with my code where I try to open the files itself.
@export var filename : String
func set_file():
file = FileAccess.open(filename, FileAccess.READ)
if file == null:
var error_str: String = error_string(FileAccess.get_open_error())
push_warning("Couldn't open file because: %s" % error_str)
Okay, so it turns out I didn’t put the name of the file in the export field for the variable. Oops. It worked once I did that, and the importer thing allowed me to see the .sm files in the editor, which was super cool. So thanks for that.