Files
plugin-library/Assets/Main/Script/Editor/DomainBaseEditor.cs
2025-05-23 18:26:47 +08:00

79 lines
3.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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;
// /// <summary>
// /// 序列化属性在OnEnable中获取
// /// </summary>
// [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<DomainConfig>(
// $"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();
// }
// }
// }