using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace UnityEditor.UI
{
[CustomEditor(typeof(Scrollbar), true)]
[CanEditMultipleObjects]
///
/// Custom Editor for the Scrollbar Component.
/// Extend this class to write a custom editor for a component derived from Scrollbar.
///
public class ScrollbarEditor : SelectableEditor
{
SerializedProperty m_HandleRect;
SerializedProperty m_Direction;
SerializedProperty m_Value;
SerializedProperty m_Size;
SerializedProperty m_NumberOfSteps;
SerializedProperty m_OnValueChanged;
protected override void OnEnable()
{
base.OnEnable();
m_HandleRect = serializedObject.FindProperty("m_HandleRect");
m_Direction = serializedObject.FindProperty("m_Direction");
m_Value = serializedObject.FindProperty("m_Value");
m_Size = serializedObject.FindProperty("m_Size");
m_NumberOfSteps = serializedObject.FindProperty("m_NumberOfSteps");
m_OnValueChanged = serializedObject.FindProperty("m_OnValueChanged");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space();
serializedObject.Update();
// EditorGUILayout.PropertyField(m_HandleRect);
EditorGUI.BeginChangeCheck();
RectTransform newRectTransform = EditorGUILayout.ObjectField("Handle Rect", m_HandleRect.objectReferenceValue, typeof(RectTransform), true) as RectTransform;
if (EditorGUI.EndChangeCheck())
{
// Handle Rect will modify its GameObject RectTransform drivenBy, so we need to Record the old and new RectTransform.
List