源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
1.1 KiB

using UnityEngine;
using UnityEditor;
using System;
public class AutoSave : EditorWindow {
private int intervalScene = 1; //保存间隔
private string scenePath;
private DateTime lastSaveTimeScene = DateTime.Now;
void Update(){
if(DateTime.Now.Minute > (lastSaveTimeScene.Minute+intervalScene)){
if (EditorApplication.isPlaying == true){
// Debug.Log( "AutoSave 运行中,跳过本次保存!" );
}
else{
scenePath = EditorApplication.currentScene;
saveScene();
}
}
if (DateTime.Now.Minute == 1){
//超过60分之后,要回到01
lastSaveTimeScene = DateTime.Now;
}
}
void saveScene() {
EditorApplication.SaveScene(scenePath);
lastSaveTimeScene = DateTime.Now;
// Debug.Log("AutoSave 保存成功: "+scenePath+" on "+lastSaveTimeScene);
AutoSave repaintSaveWindow = (AutoSave)EditorWindow.GetWindow (typeof (AutoSave));
repaintSaveWindow.Repaint();
}
}