0 votes

Upgraded to 3.1.2 and when I export to android common save quiting doesnt work, is there any other way? does it work for you?:

func _ready() -> void:
    get_tree().set_auto_accept_quit(false);
    loadState();

func _notification(what):
    if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST or what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
        print("quiting");
        saveState();
        yield(get_tree().create_timer(.1), "timeout");      
        get_tree().quit();
in Engine by (12 points)

What is the content of saveState() ? Where do you save your data?

Android does not allow saving to i.e. 'res://' always save to some path below 'user://'

unfortunatly it is 'user://'.
For clarity if I manually call saveState() it works as expected on android

1 Answer

0 votes
func _on_Main_tree_exiting():
    pass # Replace with function body.

This function is called when the tree is leaved e.g when you close your game.

by (32 points)
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 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.