InformationSaveAndAudioCore_Over
This commit is contained in:
27
Assets/02.InformationSave/Editor/CustomEditorBaseEditor.cs
Normal file
27
Assets/02.InformationSave/Editor/CustomEditorBaseEditor.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.InformationSave
|
||||
{
|
||||
[CustomEditor(typeof(CustomEditorBase), true)]
|
||||
public class CustomEditorBaseEditor : UnityEditor.Editor
|
||||
{
|
||||
private CustomEditorBase _customEditorBase;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
_customEditorBase = target as CustomEditorBase;
|
||||
_customEditorBase.Draw();
|
||||
//这个函数告诉引擎,相关对象所属于的Prefab已经发生了更改。方便,当我们更改了自定义对象的属性的时候,自动更新到所属的Prefab中
|
||||
if (GUI.changed && EditorApplication.isPlaying == false)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
EditorUtility.SetDirty(_customEditorBase);
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2da8df4f2ba04494a90eec6fda524a49
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user