unity学习(37)——自动保存

虽然脚本图片这些东西可以自动保存,但是场景中的控件不会自动,需要增加以下控件。

unity运行自动保存_unity自动保存-CSDN博客

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();
            }
        };
    }
}
相关推荐
Sunflower_ac3 小时前
强化学习学习笔记:Lab 0–Lab 2
笔记·学习
Z21-X8 小时前
云原生运维学习笔记:Kubernetes 自动扩缩容与资源管控实战
运维·笔记·学习·云原生·kubernetes
可涵不会debug8 小时前
ChatServer 模块学习笔记:HTTP 接入层、多线程与流式响应
笔记·学习·http
console.log('npc')1 天前
Python第9课 类学习笔记,前端js语法对照
前端·python·学习
艾莉丝努力练剑1 天前
【AI大模型接入SDK】解决Unicode码转化以及界面变形问题
前端·c++·人工智能·学习·安全·架构
旖旎夜光1 天前
【C 语言】(二)模拟实现 strlen、strcpy、strcmp、strstr、memcpy、memmove
c语言·开发语言·笔记·学习
大连好光景1 天前
腾讯云 ADP 前沿部署工程师 (FDE) 学习笔记(二)
笔记·学习·agent开发平台·adp·实战练习
IT空门:门主2 天前
LangChain4j 1.24.0 深度解读:新特性、版本对比与学习路线
java·学习
Shadow(⊙o⊙)2 天前
一年间学习的总结与成长记录——记录自己的18岁
学习
 梦晓天明2 天前
1.Spring学习笔记_IOC入门案例
笔记·学习·spring