HDR color picker on inspector

In order to convert the color picker to HDR on a shader inspector, simply put [HDR] in front of the property. But this doesn’t work with a C# script. Do I have to create a custom inspector just for this or is there an easier way?

1 Like

To get the HDR color picker in the Inspector use ColorUsageAttribute.

example:
[ColorUsageAttribute(true,true,0f,8f,0.125f,3f)]
public Color colour;

! In the debug window, the color picker will still use the normal color picker.

16 Likes

Thanks! that is exactly what I was looking for.

This doesnt work for me.It displays color picker in inspector but when i pick random colors from the picker, my mesh color or emission doesnt change at all .How i can make them to change via the inspector color picker ?

To anyone else stumbling across this thread, in order to change the emissive color on your mesh you’ll need to apply it with something like meshRenderer.material.SetColor("_EmissionColor", color);.

2 Likes

Now obsolete. Above the color variable, just put [ColorUsageAttribute(true,true)]
You don’t need the rest.

6 Likes

And just to keep the story up to date, now simply use:
[ColorUsage(true, true)]

31 Likes