public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); SerializedProperty propPoints = serializedObject.FindProperty("points_"); //EditorGUILayout.PropertyField(propPoints, true); ShowList(propPoints, selected_); if (!serializedObject.isEditingMultipleObjects) { int numPoints = propPoints.arraySize; if (numPoints < 3) { EditorGUILayout.HelpBox("At least three points are required.", MessageType.Warning); } else { EditorGUILayout.HelpBox(numPoints + " points in total.", MessageType.Info); } } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Reset", EditorStyles.miniButtonLeft)) { for (int i = 0; i < targets.Length; ++i) { if (PrefabUtility.GetPrefabType(targets[i]) != PrefabType.Prefab) { PolygonalImage2D polygonalImage2D = targets[i] as PolygonalImage2D; polygonalImage2D.resetPoints(); polygonalImage2D.SetVerticesDirty(); EditorUtility.SetDirty(targets[i]); } } } if (GUILayout.Button("Reset Smaller", EditorStyles.miniButtonRight)) { for (int i = 0; i < targets.Length; ++i) { if (PrefabUtility.GetPrefabType(targets[i]) != PrefabType.Prefab) { PolygonalImage2D polygonalImage2D = targets[i] as PolygonalImage2D; polygonalImage2D.resetPointsSmaller(); polygonalImage2D.SetVerticesDirty(); EditorUtility.SetDirty(targets[i]); } } } EditorGUILayout.EndHorizontal(); if (serializedObject.ApplyModifiedProperties() || (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed")) { for (int i = 0; i < targets.Length; ++i) { if (PrefabUtility.GetPrefabType(targets[i]) != PrefabType.Prefab) { EditorUtility.SetDirty(targets[i]); } } } }