//private bool folded = false; public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty[] props = new SerializedProperty[Attribute.VariablesToStore.Length]; for (int i = 0; i < props.Length; i++) { props[i] = property.serializedObject.FindProperty(Attribute.VariablesToStore[i]); } GUILayout.BeginVertical(FEditor_Styles.Style(new Color32(250, 250, 250, 75))); EditorGUI.indentLevel++; GUIStyle foldBold = EditorStyles.foldout; foldBold.fontStyle = FontStyle.Bold; Attribute.Folded = EditorGUILayout.Foldout(Attribute.Folded, " " + Attribute.FrameTitle, true, foldBold); if (Attribute.Folded) { for (int i = 0; i < props.Length; i++) { if (props[i] != null) { EditorGUILayout.PropertyField(props[i]); } else { EditorGUILayout.LabelField("Wrong property name?"); } } } EditorGUI.indentLevel--; GUILayout.EndVertical(); }
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent content) { FPD_VerticalLimitCircleAttribute limit = attribute as FPD_VerticalLimitCircleAttribute; if (property.propertyType == SerializedPropertyType.Vector2) { float minValue = property.vector2Value.x; float maxValue = property.vector2Value.y; float minRange = limit.MinValue; float maxRange = limit.MaxValue; if (limit.drawHR) { FEditor_Styles.DrawUILine(new Color(0.55f, 0.55f, 0.55f, 0.7f)); } GUILayout.BeginHorizontal(); GUILayout.Label(content, GUILayout.MaxWidth(170f)); GUILayout.FlexibleSpace(); GUILayout.Label(Mathf.Round(minValue) + "°", FEditor_Styles.GrayBackground, GUILayout.MaxWidth(40f)); FEditor_CustomInspectorHelpers.DrawMinMaxVertSphere(-maxValue, -minValue, 14); GUILayout.Label(Mathf.Round(maxValue) + "°", FEditor_Styles.GrayBackground, GUILayout.MaxWidth(40f)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.MinMaxSlider(ref minValue, ref maxValue, minRange, maxRange); if (limit.symSlider) { adjustSymmetrical = (int)EditorGUILayout.Slider("Adjust symmetrical", adjustSymmetrical, 0f, maxRange); if (preAdjust != adjustSymmetrical) { minValue = -adjustSymmetrical; maxValue = adjustSymmetrical; preAdjust = adjustSymmetrical; } } if (limit.drawHR) { FEditor_Styles.DrawUILine(new Color(0.55f, 0.55f, 0.55f, 0.7f)); } GUILayout.Space(5f); property.vector2Value = new Vector2(minValue, maxValue); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { FEditor_Styles.DrawUILine(Attribute.color); }