public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { var intent = EditorGUI.indentLevel; position = EditorGUI.IndentedRect(position); EditorGUI.indentLevel = 0; EditorGUI.BeginChangeCheck(); var prefabInstance = property.serializedObject.targetObject as PEPrefabScript; var modificationInstance = property.GetInstance<PEModifications.PropertyData>(); SerializedProperty prefabProperty; SerializedProperty instanceProperty; modificationInstance.GetProperties(out prefabProperty, out instanceProperty, prefabInstance); if (instanceProperty == null) return; var mode = property.FindPropertyRelative("Mode"); var color = GUI.color; GUI.color = mode.enumValueIndex == 0 ? new Color(1, 1, 1, 1) : (mode.enumValueIndex == 1 ? new Color(0, 1, 0, 1) : new Color(1, 0, 0, 1)); position.x -= 6; position.width += 6; GUI.Box(position, "", "Window"); position.x += 12; position.width -= 18; GUI.color = color; var enabled = GUI.enabled; GUI.enabled = false; var height = EditorGUI.GetPropertyHeight(instanceProperty); position.y += EditorGUIUtility.singleLineHeight + 3; if (prefabProperty != null) EditorGUI.PropertyField(new Rect(position) { height = height }, prefabProperty, true); else EditorGUI.LabelField(new Rect(position) { height = height }, "Property not exist"); position.y += height + 2; GUI.enabled = enabled; EditorGUI.PropertyField(new Rect(position) { height = height }, instanceProperty, true); position.y += height; var buttons = GetButtonsData(prefabInstance, prefabProperty, instanceProperty); position.y += 3; var startRect = new Rect(position) { height = 15, width = position.width / (buttons.Length + 1), }; var lw = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 0; EditorGUIUtility.fieldWidth = 0; EditorGUI.PropertyField(new Rect(startRect) { width = startRect.width - 6 }, mode, new GUIContent("", "Select proprty mode"), true); EditorGUIUtility.labelWidth = lw; startRect.x += startRect.width; var i = 0; foreach (var button in buttons) { var style = i == 0 ? EditorStyles.miniButtonLeft : (i == buttons.Length - 1 ? EditorStyles.miniButtonRight : EditorStyles.miniButtonMid); if (GUI.Button(startRect, button.Key, style)) button.Value(); startRect.x += startRect.width; i++; } startRect.x = position.x; startRect.y += startRect.height; if (EditorGUI.EndChangeCheck()) { instanceProperty.serializedObject.ApplyModifiedProperties(); if (prefabProperty != null) prefabProperty.serializedObject.ApplyModifiedProperties(); } EditorGUI.indentLevel = intent; }