| 123456789101112131415161718192021222324252627282930313233343536 |
- using UnityEditor;
- [CustomEditor(typeof(JC.ScrollPanel))]
- public class ScrollPanelInspector : Editor
- {
- private JC.ScrollPanel scrollPanel;
- private SerializedProperty initType,startIndex, spacing, openReceiveItemViewInfo, onReceiveItemViewInfo, prefabs , offset;
- void OnEnable()
- {
- scrollPanel = target as JC.ScrollPanel;
- initType = serializedObject.FindProperty("initType");
- startIndex = serializedObject.FindProperty("startIndex");
- spacing = serializedObject.FindProperty("spacing");
- offset = serializedObject.FindProperty("offset");
- openReceiveItemViewInfo = serializedObject.FindProperty("openReceiveItemViewInfo");
- onReceiveItemViewInfo = serializedObject.FindProperty("onReceiveItemViewInfo");
- prefabs = serializedObject.FindProperty("prefabs");
- }
- public override void OnInspectorGUI()
- {
- serializedObject.Update();
- EditorGUILayout.PropertyField(initType);
- EditorGUILayout.PropertyField(startIndex);
- EditorGUILayout.PropertyField(spacing);
- EditorGUILayout.PropertyField(offset);
- EditorGUILayout.PropertyField(openReceiveItemViewInfo);
- if (scrollPanel.openReceiveItemViewInfo) {
- EditorGUILayout.PropertyField(onReceiveItemViewInfo);
- }
- EditorGUILayout.PropertyField(prefabs);
- serializedObject.ApplyModifiedProperties();
- PrefabUtility.RecordPrefabInstancePropertyModifications(scrollPanel);
- }
- }
|