10 [CustomEditor(typeof(ScrollPositionController))]
11 [CanEditMultipleObjects]
14 SerializedProperty viewport;
15 SerializedProperty directionOfRecognize;
16 SerializedProperty movementType;
17 SerializedProperty elasticity;
18 SerializedProperty scrollSensitivity;
19 SerializedProperty inertia;
20 SerializedProperty decelerationRate;
21 SerializedProperty snap;
22 SerializedProperty snapEnable;
23 SerializedProperty snapVelocityThreshold;
24 SerializedProperty snapDuration;
25 SerializedProperty dataCount;
29 viewport = serializedObject.FindProperty(
"viewport");
30 directionOfRecognize = serializedObject.FindProperty(
"directionOfRecognize");
31 movementType = serializedObject.FindProperty(
"movementType");
32 elasticity = serializedObject.FindProperty(
"elasticity");
33 scrollSensitivity = serializedObject.FindProperty(
"scrollSensitivity");
34 inertia = serializedObject.FindProperty(
"inertia");
35 decelerationRate = serializedObject.FindProperty(
"decelerationRate");
36 snap = serializedObject.FindProperty(
"snap");
37 snapEnable = serializedObject.FindProperty(
"snap.Enable");
38 snapVelocityThreshold = serializedObject.FindProperty(
"snap.VelocityThreshold");
39 snapDuration = serializedObject.FindProperty(
"snap.Duration");
40 dataCount = serializedObject.FindProperty(
"dataCount");
45 serializedObject.Update();
46 EditorGUILayout.PropertyField(viewport);
47 EditorGUILayout.PropertyField(directionOfRecognize);
48 EditorGUILayout.PropertyField(movementType);
49 EditorGUILayout.PropertyField(elasticity);
50 EditorGUILayout.PropertyField(scrollSensitivity);
51 EditorGUILayout.PropertyField(inertia);
52 DrawInertiaRelatedValues();
53 EditorGUILayout.PropertyField(dataCount);
54 serializedObject.ApplyModifiedProperties();
57 void DrawInertiaRelatedValues()
59 if (inertia.boolValue)
61 EditorGUILayout.PropertyField(decelerationRate);
62 EditorGUILayout.PropertyField(snap);
64 using (
new EditorGUI.IndentLevelScope())
66 DrawSnapRelatedValues();
71 void DrawSnapRelatedValues()
75 EditorGUILayout.PropertyField(snapEnable);
77 if (snapEnable.boolValue)
79 EditorGUILayout.PropertyField(snapVelocityThreshold);
80 EditorGUILayout.PropertyField(snapDuration);
Credit Erdener Gonenc - @PixelEnvision.