/// <summary> /// Checks when it's time to AutoSave and make backups. /// </summary> static void OnUpdate() { if ((DateTime.Now - LastSaveTime).TotalMinutes >= SaveMinutes) { int sc = EditorSceneManager.sceneCount; for (int i = 0; i < sc; i++) { // Show popup or save scenes only if there is at least one dirty. if (EditorSceneManager.GetSceneAt(i).isDirty) { if (ShowPopup) { AutoSavePopup.ShowAutoSavePopup(SaveScenes, PopupTimeout); } else { SaveScenes(); } break; } } LastSaveTime = DateTime.Now; } }