void drawSplineMode(ClayObject clayObj) { EditorGUI.BeginChangeCheck(); int subdivs = EditorGUILayout.IntField("subdivs", clayObj.getSplineSubdiv()); var list = this.serializedObject.FindProperty("splinePoints"); EditorGUILayout.PropertyField(list, new GUIContent("spline points"), true); if (EditorGUI.EndChangeCheck()) { this.serializedObject.ApplyModifiedProperties(); clayObj.setSplineSubdiv(subdivs); UnityEditor.EditorApplication.QueuePlayerLoopUpdate(); } }
void drawSplineMode(ClayObject clayObj) { EditorGUI.BeginChangeCheck(); int subdivs = EditorGUILayout.IntField("subdivs", clayObj.getSplineSubdiv()); GUILayout.BeginHorizontal(); int numPoints = clayObj.splinePoints.Count - 2; EditorGUILayout.LabelField("control points: " + numPoints); if (GUILayout.Button(new GUIContent("+", ""))) { clayObj.addSplineControlPoint(); } if (GUILayout.Button(new GUIContent("-", ""))) { clayObj.removeLastSplineControlPoint(); } GUILayout.EndHorizontal(); // var list = this.serializedObject.FindProperty("splinePoints"); // EditorGUILayout.PropertyField(list, new GUIContent("spline points"), true); if (EditorGUI.EndChangeCheck()) { // this.serializedObject.ApplyModifiedProperties(); clayObj.setSplineSubdiv(subdivs); UnityEditor.EditorApplication.QueuePlayerLoopUpdate(); } }