// using UnityEditor; // using UnityEngine; // // namespace Stary.Evo // { // [CustomEditor(typeof(DomainBase), true)] // public class DomainBaseEditor : UnityEditor.Editor // { // //定义序列化属性 // // private SerializedProperty intValue; // // private SerializedProperty floatValue; // // private SerializedProperty stringValue; // // private SerializedProperty boolValue; // // private SerializedProperty vector3Value; // // private SerializedProperty enumValue; // // private SerializedProperty colorValue; // // private SerializedProperty textureValue; // /// // /// 序列化属性,在OnEnable中获取 // /// // [HideInInspector] // private SerializedProperty domainConfig; // [HideInInspector] // private SerializedProperty domainName; // // private UnityEditor.Editor cacheEditor; // private void OnEnable() // { // domainConfig = serializedObject.FindProperty("domainConfig"); // if (!Application.isPlaying) // { // // domainName = serializedObject.FindProperty("DomainName"); // domainConfig.objectReferenceValue = // AssetDatabase.LoadAssetAtPath( // $"Assets/Domain/{domainName.stringValue}/AddressableRes/Config/DomainConfig.asset"); // } // //通过名字查找被序列化属性。 // // intValue = serializedObject.FindProperty("intValue"); // // floatValue = serializedObject.FindProperty("floatValue"); // // stringValue = serializedObject.FindProperty("stringValue"); // // boolValue = serializedObject.FindProperty("boolValue"); // // vector3Value = serializedObject.FindProperty("vector3Value"); // // enumValue = serializedObject.FindProperty("enumValue"); // // colorValue = serializedObject.FindProperty("colorValue"); // // textureValue = serializedObject.FindProperty("textureValue"); // } // // public override void OnInspectorGUI() // { // //表示更新序列化物体 // serializedObject.Update(); // // // EditorGUILayout.PropertyField(domainConfig,new GUIContent("111"),true); // // // var data = ((DomainConfig)domainConfig.objectReferenceValue); // if (data != null) // { // //创建TestClass的Editor // if (cacheEditor == null) // cacheEditor = UnityEditor. Editor.CreateEditor(data); // cacheEditor.OnInspectorGUI(); // } // // // // EditorGUILayout.PropertyField(intValue); // // EditorGUILayout.PropertyField(floatValue); // // EditorGUILayout.PropertyField(stringValue); // // EditorGUILayout.PropertyField(boolValue); // // EditorGUILayout.PropertyField(vector3Value); // // EditorGUILayout.PropertyField(enumValue); // // EditorGUILayout.PropertyField(colorValue); // // EditorGUILayout.PropertyField(textureValue); // //应用修改的属性值,不加的话,Inspector面板的值修改不了 // serializedObject.ApplyModifiedProperties(); // } // } // }