Forum rules - please read before posting.

[Mobile] Saving the game on losing focus

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?

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:

    AC.SaveSystem.SaveGame (mySaveID);
    
  • Yes i just did it like that. If is in cutacene, won”t save.
    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.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.