Search Unity

Show HDR Color in Custom Material Inspector

Discussion in 'Universal Render Pipeline' started by RicardoDaForce, Sep 15, 2021.

  1. RicardoDaForce

    RicardoDaForce

    Joined:
    Jan 5, 2014
    Posts:
    3
    Hi there,

    I've made my own custom material inspector one of my shaders.
    I have an Emission Color parameter and I want the material editor to show it as an HDR color. But I don't know how to show it as one.

    My function in code looks like this...
    upload_2021-9-15_13-29-12.png
    and it looks like this in the inspector.

    upload_2021-9-15_13-29-38.png

    How do I make Emission Color act like this...
    upload_2021-9-15_13-29-59.png

    I can see that it can sort of be done by using...

    Code (CSharp):
    1. _materialEditor.TexturePropertyWithHDRColor()
    But...I don't want a texture input! So this doesn't work.

    Thanks,
    - Rich
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    Hi!
    You need to put an
    [HDR]
    property prefix in the .shader file.
    Like this:
    [HDR] _EmissionColor("Color", Color) = (0,0,0)