public bool DisplayProperty(SerializedProperty property, FieldInfo field, GUIContent label) { object value = null; var enumValueRaw = property.enumNames[property.enumValueIndex]; var enumValue = Enum.Parse(field.FieldType, enumValueRaw); value = enumValue; var obsolete = value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(ObsoleteAttribute), true); if (IsValid(value) == false) { return(ExtendedInspectorDrawerAttribute.DrawProperty(false, label, () => EditorGUILayout.PropertyField(property, label), Color.red, GetError(value))); } else if (obsolete.Length > 0) { return(ExtendedInspectorDrawerAttribute.DrawProperty(false, label, () => EditorGUILayout.PropertyField(property, label), Color.yellow, GetError(value))); } else { return(ExtendedInspectorDrawerAttribute.DrawProperty(true, label, () => EditorGUILayout.PropertyField(property, label))); } }
public bool DisplayProperty(SerializedProperty property, FieldInfo field, GUIContent label) { if (property.propertyType == SerializedPropertyType.String) { return(ExtendedInspectorDrawerAttribute.DrawProperty(IsValid(property.stringValue), label, () => EditorGUILayout.PropertyField(property, label), GetError(property.stringValue))); } return(EditorGUILayout.PropertyField(property, label)); }
public bool DisplayProperty(SerializedProperty property, FieldInfo field, GUIContent label) { if (property.propertyType == SerializedPropertyType.ObjectReference) { var texture = property.objectReferenceValue as Texture2D; return(ExtendedInspectorDrawerAttribute.DrawProperty(IsValid(texture), label, () => EditorGUILayout.PropertyField(property, label), GetError(texture))); } return(EditorGUILayout.PropertyField(property, label)); }
public bool DisplayProperty(SerializedProperty property, FieldInfo field, GUIContent label) { object value = null; if (property.propertyType == SerializedPropertyType.String) { value = property.stringValue; } else if (property.propertyType == SerializedPropertyType.ObjectReference) { value = property.objectReferenceValue; } return(ExtendedInspectorDrawerAttribute.DrawProperty(IsValid(value), label, () => EditorGUILayout.PropertyField(property, label), GetError(value))); }