public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { ColorUsageAttribute colorUsageAttribute = (ColorUsageAttribute)base.attribute; EditorGUI.BeginChangeCheck(); Color colorValue = EditorGUI.ColorField(position, label, property.colorValue, true, colorUsageAttribute.showAlpha, colorUsageAttribute.hdr); if (EditorGUI.EndChangeCheck()) { property.colorValue = colorValue; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { ColorUsageAttribute attribute = (ColorUsageAttribute)base.attribute; ColorPickerHDRConfig hdrConfig = ColorPickerHDRConfig.Temp(attribute.minBrightness, attribute.maxBrightness, attribute.minExposureValue, attribute.maxExposureValue); EditorGUI.BeginChangeCheck(); Color color = EditorGUI.ColorField(position, label, property.colorValue, true, attribute.showAlpha, attribute.hdr, hdrConfig); if (EditorGUI.EndChangeCheck()) { property.colorValue = color; } }
public override void ProcessSelfAttributes(InspectorProperty property, List <Attribute> attributes) { for (int i = 0; i < attributes.Count; i++) { var attr = attributes[i]; if (attr is ColorUsagePropertyAttribute) { var cast = attr as ColorUsagePropertyAttribute; attributes[i] = new ColorUsageAttribute(cast.showAlpha, cast.hdr); } } }