/// <summary> /// Restrain a property value to a maximum one. /// </summary> /// <param name="_property">Editing property.</param> /// <param name="_label">Displayed label.</param> /// <param name="_maxValue">Property max value.</param> public static void MaxField(SerializedProperty _property, GUIContent _label, float _maxValue) { Rect _rect = EditorGUILayout.GetControlRect(true); EditorGUIEnhanced.MaxField(_rect, _property, _label, _maxValue); }
/*************************** ******* METHODS ******* **************************/ // Make your own IMGUI based GUI for the property public override void OnGUI(Rect _position, SerializedProperty _property, GUIContent _label) { MaxAttribute _attribute = (MaxAttribute)attribute; EditorGUIEnhanced.MaxField(_position, _property, _label, _attribute.MaxValue); }