File reading and writing not working as expected

Godot Version



Does anyone know why the file is null when being read, but not when trying to write? And even though the file isn’t null when trying to write, it doesn’t seem to actually write anything to the file (only an unknown symbol). I’m trying to save the player’s high score, which is just an int.

I asked on Discord and a kind user provided the use of ResourceSaver and ResourceLoader as an alternative which worked, but I’d like to understand why the file system didn’t work as expected.

it’s a different file, “save_game.dat” doesn’t exist. writing is creating “save_score.dat”

1 Like

Welp, I feel like digging myself a hole now. I looked it over so many times but completely missed the different file names. Thanks for pointing it out though, I was going a bit crazy wondering why it didn’t work.