void Update() { if (autoSaveScene && CheckTimeInterval()) { SaveScene(); lastAutoSaveTime = Khronos.UnixTimeNow(); } }
bool CheckTimeInterval() { if (Khronos.UnixTimeNow() >= (lastAutoSaveTime + autoSaveInterval * 60)) { return(true); } else { return(false); } }
void SaveScene() { Scene activeScene = EditorSceneManager.GetActiveScene(); if (activeScene.isDirty) { bool savedScene = EditorSceneManager.SaveScene(activeScene); if (savedScene) { Debug.unityLogger.Log(GetType().ToString(), "Active scene was auto-saved at " + Khronos.UnixTimeNow()); } AssetDatabase.SaveAssets(); } }