void saveScene() { EditorApplication.SaveScene(scenePath); lastSaveTimeScene = DateTime.Now; isStarted = true; if (showMessage) { Debug.Log("AutoSave saved: " + scenePath + " on " + lastSaveTimeScene); } AutoSave repaintSaveWindow = (AutoSave)EditorWindow.GetWindow(typeof(AutoSave)); repaintSaveWindow.Repaint(); }
public static void LoadPreferences() { if (AutoSavePreferences.autosaveEnabled) { if (timer == null) { timer = new System.Timers.Timer(); timer.Interval = AutoSavePreferences.saveInterval; timer.Elapsed += new ElapsedEventHandler(timerFired); timer.Start(); } else { if (timer.Interval != AutoSavePreferences.saveInterval) { timer.Interval = AutoSavePreferences.saveInterval; } } } else { if (timer != null) { timer.Stop(); timer.Dispose(); timer = null; } } EditorApplication.hierarchyWindowChanged -= HierarchyChanged; EditorApplication.playModeStateChanged -= playModeChanged; EditorApplication.hierarchyWindowChanged += HierarchyChanged; EditorApplication.playModeStateChanged += playModeChanged; if (instance != null) { instance.Repaint(); } }
void saveScene() { if (EditorApplication.isPlaying) { return; } Scene activeScene = SceneManager.GetActiveScene(); EditorSceneManager.SaveScene(activeScene); lastSaveTimeScene = DateTime.Now; isStarted = true; AutoSave repaintSaveWindow = (AutoSave)GetWindow(typeof(AutoSave)); repaintSaveWindow.Repaint(); if (showMessage) { Debug.Log("AutoSave saved: " + scenePath + " on " + lastSaveTimeScene); } }