private void UpdateAutoSave() { string msg = null; var options = Options.Options.General; var canSave = StateMachine.IsEditMode && options.EnableAutoSave; if (canSave) { var timeSinceLastSave = Time.UnscaledGameTime - _lastAutoSaveTimer; var timeToNextSave = options.AutoSaveFrequency * 60.0f - timeSinceLastSave; var countDownDuration = 4.0f; if (timeToNextSave <= 0.0f) { Log("Auto save"); _lastAutoSaveTimer = Time.UnscaledGameTime; if (options.AutoSaveScenes) { Scene.SaveScenes(); } if (options.AutoSaveContent) { SaveContent(); } } else if (timeToNextSave < countDownDuration) { msg = string.Format("Auto save in {0}s...", Mathf.CeilToInt(timeToNextSave)); } } if (StateMachine.EditingSceneState.AutoSaveStatus != msg) { StateMachine.EditingSceneState.AutoSaveStatus = msg; UI.UpdateStatusBar(); } }
/// <summary> /// Saves all changes (scenes, assets, etc.). /// </summary> public void SaveAll() { // Layout Windows.SaveCurrentLayout(); // Scenes Scene.SaveScenes(); // Assets for (int i = 0; i < Windows.Windows.Count; i++) { if (Windows.Windows[i] is AssetEditorWindow win) { win.Save(); } } }