53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Ether
|
|
{
|
|
public class SceneSaveManagerEditor
|
|
{
|
|
public static ES3ReferenceMgr RefMgr
|
|
{
|
|
get { return (ES3ReferenceMgr)ES3ReferenceMgr.Current; }
|
|
}
|
|
|
|
[MenuItem("GameObject/场景/场景保存管理器", priority = 0)]
|
|
public static void CreateSceneSaveManager()
|
|
{
|
|
GameObject mgr = null;
|
|
if (RefMgr != null)
|
|
mgr = RefMgr.gameObject;
|
|
|
|
if (mgr == null)
|
|
mgr = new GameObject("SceneSaveManager");
|
|
|
|
if (mgr.GetComponent<ES3ReferenceMgr>() == null)
|
|
{
|
|
var refMgr = mgr.AddComponent<ES3ReferenceMgr>();
|
|
|
|
if (!Application.isPlaying && ES3Settings.defaultSettingsScriptableObject.autoUpdateReferences)
|
|
refMgr.RefreshDependencies();
|
|
}
|
|
|
|
if (mgr.GetComponent<ES3AutoSaveMgr>() == null)
|
|
{
|
|
ES3AutoSaveMgr autoSaveMgr = mgr.AddComponent<ES3AutoSaveMgr>();
|
|
}
|
|
|
|
if (mgr.GetComponent<SceneSaveManager>() == null)
|
|
{
|
|
mgr.AddComponent<SceneSaveManager>();
|
|
}
|
|
|
|
Undo.RegisterCreatedObjectUndo(mgr, "Enabled Easy Save for Scene");
|
|
|
|
|
|
|
|
Selection.activeObject = mgr;
|
|
}
|
|
}
|
|
}
|