public void OnInspectorGUI(UnityEngine.Object target, SerializedObject serializedObject) { serializedObject.Update(); EditorGUILayout.PropertyField(viewport); EditorGUILayout.PropertyField(directionOfRecognize); EditorGUILayout.PropertyField(movementType); EditorGUILayout.PropertyField(scrollSensitivity); EditorGUILayout.PropertyField(inertia); DrawInertiaRelatedValues(); EditorGUILayout.BeginHorizontal(); int newvalue = EditorGUILayout.IntField("dataCount", dataCount.intValue); if (newvalue != dataCount.intValue) { dataCount.intValue = newvalue; } if (Application.isPlaying && GUILayout.Button("Sure")) { BaseFancyScrollView view = target as BaseFancyScrollView; ScrollPositionController controller = view.controller as ScrollPositionController; controller.SetDataCount(newvalue); if (view != null) { if (field == null) { field = view.GetType().GetField("cellData", BindingFlags.Instance | BindingFlags.NonPublic); list = (IList)field.GetValue(view); } int datacnt = controller.GetDataCount(); if (datacnt < list.Count) { for (int i = list.Count - 1; i >= datacnt; --i) { list.RemoveAt(i); } } else { Type ListElementType = list.GetType().GetGenericArguments()[0]; for (int i = list.Count; i < datacnt; ++i) { list.Add(Activator.CreateInstance(ListElementType)); } } view.RefreshCells(); } } EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); }