Forum rules - please read before posting.

Autosave without freezing

I have the following problems with autosave, assuming "Take screenshot when saving" is checked:

  • During the screenshot the screen appears frozen for a short while. This isn't really noticeable during manual saves, but a bit can look jittery and laggy during autosaves
  • I'd like to autosave whenever a new scene is entered. This result in either a black screen shot (because the scene is fading in) or, if I delay it, the above mentioned problem occur.

I understand that it's probably impossible to get rid of the short freeze, but could we maybe add an option not to take screenshots during autosaves (but keep them for regular saves)? And if so let the SavesList menu specify an "Autosave texture"?



  • The freeze is necessary in order to take the screenshot. Saves without screenshots can be assigned an "Empty slot texture" in the SavesList element.

    You can make screenshots dependent on the save time by hooking into the OnBeforeSaving custom event:

    using UnityEngine;
    using System.Collections;
    using AC;
    public class ScreenshotManualSaves : MonoBehaviour
        private void OnEnable ()
            EventManager.OnBeforeSaving += PreSave;
        private void OnDisable ()
            EventManager.OnBeforeSaving -= PreSave;
        private void PreSave (int saveID)
            bool isManualSave = (saveID > 0);
            KickStarter.settingsManager.takeSaveScreenshots = isManualSave;
  • edited July 5

    Cool, while this solves the flickering, it brings up two new issues:

    1. If the last save was an autosave, then the load & save menus hides all screenshots. This occurs even after adding the following code:

    EventManager.OnFinishSaving += (SaveFile saveFile) => KickStarter.settingsManager.takeSaveScreenshots = true;

    1. In order to get the load & save menus to layout OK before there are any games saved I need to check "Allow empty slots" which will make use of the same "Empty slot texture" as the autosave. The Autosave slot is truly an exceptional one and it would be awesome if it could have a custom visual.
  • Any ideas?
    I'm rather stuck with this and worst case I have to go back to the old list of just showing labels.

    1. Is the Take screenshots when saving? option being correctly set in the Settings Manager? The menus would need to be turned off/on again if you change this value when they're on.
    2. You should be able to do this just by making the UI Image that's linked to the Autosave Button invisible with a zero alpha value, and then showing another image in the same place.
    1. Yes, this is done according to the code you suggested
    2. The Source for this menu is Adventure Creator, but you mean if I switch to to Unity Prefab right?
  • edited July 15

    1) Call GatherSaveFiles in your "OnFinishSaving" event:

    private void PostSave (SaveFile saveFile)
        KickStarter.settingsManager.takeSaveScreenshots = true;
        KickStarter.saveSystem.GatherSaveFiles ();

    2) Yes, though I'll conider your request for AC menus.

  • On 2), this wouldn't be possible in the form of simply adding a texture field to the SavesList element - since the element itself is not aware of what "type" of save is being listed.

    What you can do instead is create a new "SaveFileHandler" interface (the script that deals with save file handling, including screenshots) to supply a separate texture instead of a screenshot when an autosave is requested.

    See the Manual's "Custom save formats and handling" chapter. You're currently using the "SaveFileHandler_SystemFile" class, which you can duplicate, rename, and amend to suit your needs.

    In your modified copy, you'd replace the code:

    screenShot = LoadScreenshot (screenshotFilename);


    Texture2D autoSaveTexture = Resources.Load ("AutoSaveTexture") as Texture2D;
    screenShot = (isAutoSave) ? autoSaveTexture : LoadScreenshot (screenshotFilename);

    Where you've placed your texture in a Resources folder and named it "AutoSaveTexture".

  • Thanks, I'll try it out!

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.