UIFoldoutEditor.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. using UnityEngine.Rendering.UI;
  2. namespace UnityEditor.Rendering.UI
  3. {
  4. [CustomEditor(typeof(UIFoldout), true)]
  5. sealed class UIFoldoutEditor : Editor
  6. {
  7. SerializedProperty m_IsOn;
  8. SerializedProperty m_Content;
  9. SerializedProperty m_ArrowClosed;
  10. SerializedProperty m_ArrowOpened;
  11. void OnEnable()
  12. {
  13. var o = new PropertyFetcher<UIFoldout>(serializedObject);
  14. m_IsOn = o.Find("m_IsOn");
  15. m_Content = o.Find(x => x.content);
  16. m_ArrowClosed = o.Find(x => x.arrowClosed);
  17. m_ArrowOpened = o.Find(x => x.arrowOpened);
  18. }
  19. public override void OnInspectorGUI()
  20. {
  21. serializedObject.Update();
  22. EditorGUILayout.PropertyField(m_IsOn);
  23. EditorGUILayout.PropertyField(m_Content);
  24. EditorGUILayout.PropertyField(m_ArrowClosed);
  25. EditorGUILayout.PropertyField(m_ArrowOpened);
  26. serializedObject.ApplyModifiedProperties();
  27. }
  28. }
  29. }