赞
踩
今天unity崩了两次,导致我的工程重写两次!!!我整个人都要炸了
于是在网上找了autosave的攻略
unity版本:2020α(18,19应该也可以)
在工程文件的assets文件夹创建Editer文件夹,在Editer文件夹下写一个autosave.cs文件,代码如下
using UnityEditor; using UnityEngine; using UnityEditor.SceneManagement; [InitializeOnLoad] public class AutoSave { // Static constructor that gets called when unity fires up. static AutoSave() { EditorApplication.playModeStateChanged += (PlayModeStateChange state) => { // If we're about to run the scene... if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) { // Save the scene and the assets. Debug.Log("Auto-saving all open scenes... " + state); EditorSceneManager.SaveOpenScenes(); AssetDatabase.SaveAssets(); } }; } }
reference: https://forum.unity.com/threads/we-need-auto-save-feature.483853/
侵删
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。