godot-open-rpg
godot-open-rpg copied to clipboard
Resources saved to res:// at runtime get reverted: Can't save SaveGame to res:// reliably
According to @nhydock this is due to a bug in the engine: saving Resources to res://
while the game is running seems to not work as expected, but saving to the user://
dir works no problem. But if we can only save to user://
it kills one of the main points of using resources: being able to edit the savegame in the inspector
What, you can't edit resources in inspector if they're in user://?
This is all intentional within Godot as res://
is a virtual filesystem for your game's bundled assets after exporting, it should not hold any mutable data. user://
dir is outside of the project dir and is designed to hold mutable persistent data. Since the editor is only supposed to be working with your projects own files and nothing dynamic, it makes sense that you can't access user://
from the inspector
https://docs.godotengine.org/en/3.0/tutorials/io/data_paths.html https://docs.godotengine.org/en/3.0/getting_started/step_by_step/filesystem.html?highlight=user%3A%2F%2F#resource-path
Note that saving and loading does work with files in res:// within the editor right now as long as you save and load within the same run. However, any changes to the file system not performed by the editor will be reverted when you stop the running debug instance.
godotengine/godot#24646 highlights the same issue we're having
In this case wouldn't the best course of action would be to save resources to user:// after they are changed, and when loading check if they exist in user:// or else default to res:// ?
@asheraryam The point was to save debug save files in res:// so we can edit them in the inspector