虽然脚本图片这些东西可以自动保存,但是场景中的控件不会自动,需要增加以下控件。
Asset->创建Editor->创建autosave.cs,脚本代码如下:
cs
using UnityEditor;
using UnityEngine;
using UnityEditor.SceneManagement;
[InitializeOnLoad]
public class AutoSave
{
static AutoSave()
{
EditorApplication.playModeStateChanged += (PlayModeStateChange state) => {
if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
{
EditorSceneManager.SaveOpenScenes();
AssetDatabase.SaveAssets();
}
};
}
}