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();
asked Jan 6 in Engine by sciro (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.

answered Jan 23 by MrMrBlackDragon (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.