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?
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.
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);
.
Now obsolete. Above the color variable, just put [ColorUsageAttribute(true,true)]
You don’t need the rest.
And just to keep the story up to date, now simply use:
[ColorUsage(true, true)]