godot-open-rpg icon indicating copy to clipboard operation
godot-open-rpg copied to clipboard

Resources saved to res:// at runtime get reverted: Can't save SaveGame to res:// reliably

Open NathanLovato opened this issue 6 years ago • 6 comments

NathanLovato avatar Dec 31 '18 07:12 NathanLovato

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

NathanLovato avatar Jan 01 '19 02:01 NathanLovato

What, you can't edit resources in inspector if they're in user://?

Zireael07 avatar Jan 01 '19 10:01 Zireael07

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.

erodozer avatar Jan 01 '19 15:01 erodozer

godotengine/godot#24646 highlights the same issue we're having

erodozer avatar Jan 01 '19 16:01 erodozer

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:// ?

realkotob avatar Jan 04 '19 11:01 realkotob

@asheraryam The point was to save debug save files in res:// so we can edit them in the inspector

NathanLovato avatar Jan 04 '19 22:01 NathanLovato