0 votes

I want to save my game data on IndexedDB as Godot allows. But I can't see any kind of data and OS.is_userfs_persistent() return always false . I use google chrome as browser and cookies are activated.

func _ready():
    var dir = Directory.new()
    if !dir.dir_exists("user://Saves"):
        dir.open("user://")
        dir.make_dir("user://Saves")
    if OS.is_userfs_persistent():
        print("IndexedDB works")

It would be very helpful if somebody can help me to solve this problem.

in Engine by (28 points)

You actually don't write any data, you just create a directory. It might be that the userfs only stores actual files (with their path). Just guessing though.

Try to open and write a file.

I can write to user:// in HTML5 and I can see the data in the (Firefox) Inspector under Indexed DB -> -> /userfs -> FILEDATA -> one key per file name. I didn't check isuserfs_persistent though.

Here's my app if you want to check if your browser is compatible with Godot and Indexed DB:

https://sites.google.com/view/narrowboat-simulator/try-it

Just change something in the game options and data should be written to Indexed DB.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.