Hi there!
I was wondering if there is already some function that allows me to save my game or progress by using AC, leveraging on some Unity APIs, so that the game autosaves as soon as the game loses focus (screen switch off, receive a call, about to be unloaded, etc.)
How do you handle such cases?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
You could combine Unity's OnApplicationFocus event with AC's SaveAutoSave
SaveSystem.SaveAutoSave() will overwrite the current autosave file.
OnApplicationFocus documentation
Hi, beware. I did this, but if you lose focus during a cutscene, when game will resume will be stuck.
Then You could just make autosave before any cutscene and add check if in cutscene on losing focus -> Don't autosave
There's no need for switching focus or autosaving - you can save the game manually using the SaveGame function:
Doing autosave through script while losing focus is reay a time saver, you can avoid to make it manually every time
Saving isn't possible during cutscenes - if a gameplay-blocking ActionList is running (other than the one with the Save: Save or load Action is run), then saving will be prevented and reported in the Console.