Exemple #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var nwsa    = (NotWhiteSpaceAttribute)attribute;
            var message = string.IsNullOrEmpty(nwsa.Message) ? "Should not be empty or whitespace" : nwsa.Message;

            AttributeDrawerHelpers.MessageDrawerOnGUI(position, property, label, SerializedPropertyType.String,
                                                      CheckValue, message);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var nwsa    = (RequireLayerAttribute)attribute;
            var message = string.IsNullOrEmpty(nwsa.Message) ? "Requires a layer" : nwsa.Message;

            AttributeDrawerHelpers.MessageDrawerOnGUI(position, property, label, SerializedPropertyType.LayerMask,
                                                      CheckValue, message);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var nna     = (NotNullAttribute)attribute;
            var message = string.IsNullOrEmpty(nna.Message) ? "Should not be null" : nna.Message;

            AttributeDrawerHelpers.MessageDrawerOnGUI(position, property, label, SerializedPropertyType.ObjectReference,
                                                      CheckValue, message);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var minAttribute = (MinAttribute)attribute;

            if (property.hasMultipleDifferentValues)
            {
                EditorGUI.showMixedValue = true;
            }

            AttributeDrawerHelpers.ValueRestrictionDrawerOnGUI(position, property, label,
                                                               i => Mathf.Max(i, (int)minAttribute.Value), f => Mathf.Max(f, minAttribute.Value));
            EditorGUI.showMixedValue = false;
        }