How to Draw Gradient in Editor Inspector?

EditorGUILayout.ColorField(value);
EditorGUILayout.PropertyField(property);

Only the paint color,Which API is drawing Gradient?

2658402--187445--QQ图片20160531153614.png

You cannot directly render a Gradient using EditorGUILayout. Instead, you can (and should) dynamically create a texture of the gradient you want and draw that.

In fact, i just verified - Unity’s Color picker (the window that is shown for picking colors) does just that:

2 Likes